Mon soucis est le suivant: dès que je sors de l'écran 'screen', je rend la main à la souris windows et dès que j'y retourne, c'est un sprite qui reprend la main, jusque la pas de soucis, sauf que :
Essayez le code suivant, cliquez et laissez le clic appuyé puis sortez de l'écran, relâchez le clic puis revenez sur le 'screen', le clic de la souris est toujours actif

Code : Tout sélectionner
#MAIN_WIN = 0
#SPR_MOUSE = 1
#SCREEN_Width = 280
#SCREEN_Height = 192
_iInside = #True
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("Error", "Can't open the sprite system", 0)
End
EndIf
If OpenWindow(#MAIN_WIN, 0, 0, #SCREEN_Width, #SCREEN_Height, "", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(#MAIN_WIN), 0, 0, #SCREEN_Width, #SCREEN_Height, 0, 0, 0)
; Ugly mouse
CreateSprite(#SPR_MOUSE, 10, 10)
StartDrawing(SpriteOutput(#SPR_MOUSE))
Box(0,0,10,10,$FFFF00)
StopDrawing()
Else
MessageRequester("Error", "Can't open windowed screen!", 0)
End
EndIf
Repeat
Repeat
_iEventWindow = WaitWindowEvent(5)
Select _iEventWindow
Case #PB_Event_CloseWindow
_iQuit = 1
EndSelect
Until _iEventWindow = 0
FlipBuffers()
If _iInside = #True : ExamineMouse() : EndIf
_iBut_left = MouseButton(#PB_MouseButton_Left)
_iBut_middle = MouseButton(#PB_MouseButton_Middle)
_iBut_right = MouseButton(#PB_MouseButton_Right)
If _iInside
; Outside the screen ?
If MouseX() >= #SCREEN_Width - 1 Or MouseY() >= #SCREEN_Height - 1 Or MouseX() < 1 Or MouseY() < 1
ReleaseMouse(1)
_iInside = #False
EndIf
Else
_iMousePosX = WindowMouseX(#MAIN_WIN) : _iMousePosY = WindowMouseY(#MAIN_WIN)
; Inside the screen ?
If _iMousePosX < #SCREEN_Width And _iMousePosX > 0 And _iMousePosY > 0 And _iMousePosY < #SCREEN_Height
ReleaseMouse(0)
MouseLocate(_iMousePosX, _iMousePosY)
_iInside = #True
EndIf
EndIf
ExamineKeyboard()
_iPosX = MouseX() : _iPosY = MouseY()
; Clear screen
ClearScreen(RGB(150,255,150))
; Display Mouse only when it's inside the screen
If _iInside = #True : DisplayTransparentSprite(#SPR_MOUSE, _iPosX, _iPosY) : EndIf
; Check Left Button clicked
If _iBut_left
StartDrawing(ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(_iPosX, _iPosY, "Button Left clicked")
StopDrawing()
EndIf
; 'Esc' ?
If KeyboardPushed(#PB_Key_Escape)
_iQuit = #True
EndIf
Until _iQuit
EndIf
Merci de votre aide
