ich habe eine frage, warum ist die einschränkung die ich mit ClipCursor_() gesetzt habe, nach einem taskswitch (alt+tab) immernoch vorhanden und durch z.b. die windows taste nicht mehr?!
Code: Alles auswählen
#Title = "Test"
#Error = "Error"
#WinWidth = 640
#WinHeight = 480
Procedure ClientX(WindowID.l)
  ClientRect.RECT
  GetWindowRect_(WindowID, @ClientRect)
  ClientPoint.POINT
  ClientToScreen_(WindowID, @ClientPoint)
  Result = WindowX() + (ClientPoint\X - ClientRect\left)
  ProcedureReturn Result.l
EndProcedure
Procedure ClientY(WindowID.l)
  ClientRect.RECT
  GetWindowRect_(WindowID, @ClientRect)
  ClientPoint.POINT
  ClientToScreen_(WindowID, @ClientPoint)
  Result = WindowY() + (ClientPoint\Y - ClientRect\top)
  ProcedureReturn Result.l
EndProcedure
If OpenWindow(0, 0, 0, #WinWidth, #WinHeight, #PB_Window_ScreenCentered, #Title)
  AddKeyboardShortcut(0, #PB_Shortcut_Escape, 0)
EndIf
Repeat
  
  If GetForegroundWindow_() = WindowID()
    MouseRect.RECT
    MouseRect\left = ClientX(WindowID())
    MouseRect\top = ClientY(WindowID())
    MouseRect\right = ClientX(WindowID()) + WindowWidth()
    MouseRect\bottom = ClientY(WindowID()) + WindowHeight()
    ClipCursor_(MouseRect.RECT)
  EndIf
  
  EventID.l = WaitWindowEvent()
  Select EventID
    Case #PB_Event_Menu
      Select MenuID()
        Case #PB_Shortcut_Escape
          End
      EndSelect
    Case #PB_Event_CloseWindow
      End
  EndSelect
  
ForEver
Endc ya,
nco2k


 ) Wahrscheinlich gibt es Situationen, in denen Windows die Aufgabe der Begrenzung erzwingt (windows taste - aber z. B. auch, wenn Du alt+tab drückst und dann das neu fokusierte Fenster verschiebst).  Jetzt kommte es drauf an, was Du willst. Ich gebe Dir mal ein Code Beispiel - hoffe es hilft Dir weiter (musst Du in Deinem Code einsetzen):
) Wahrscheinlich gibt es Situationen, in denen Windows die Aufgabe der Begrenzung erzwingt (windows taste - aber z. B. auch, wenn Du alt+tab drückst und dann das neu fokusierte Fenster verschiebst).  Jetzt kommte es drauf an, was Du willst. Ich gebe Dir mal ein Code Beispiel - hoffe es hilft Dir weiter (musst Du in Deinem Code einsetzen):