Code : Tout sélectionner
Enumeration
#My_Event_LeftClick_Down = #PB_Event_FirstCustomValue
#My_Event_RightClick_Down
#My_Event_MiddleClick_Down
#My_Event_MiddleClick_Up
EndEnumeration
Procedure wc (hWnd, uMsg, wParam, lParam)
Select uMsg
Case #WM_LBUTTONDOWN
PostEvent(#My_Event_LeftClick_Down)
Case #WM_RBUTTONDOWN
PostEvent(#My_Event_RightClick_Down)
Case #WM_MBUTTONDOWN
PostEvent(#My_Event_MiddleClick_Down)
Case #WM_MBUTTONUP
PostEvent(#My_Event_MiddleClick_Up)
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
If OpenWindow(0,0,0,200,200,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetWindowCallback(@wc())
Repeat
eventid = WaitWindowEvent()
Select eventid
Case #PB_Event_CloseWindow
Quitter=1
Case #My_Event_LeftClick_Down
Debug "Bouton gauche appuyé"
Case #PB_Event_LeftClick
Debug "Bouton gauche relâché"
Case #My_Event_RightClick_Down
Debug "Bouton droit appuyé"
Case #PB_Event_RightClick
Debug "Bouton droit relâché"
Case #My_Event_MiddleClick_Down
Debug "Bouton milieu appuyé"
Case #My_Event_MiddleClick_Up
Debug "Bouton milieu relâché"
EndSelect
Until Quitter
EndIf