I would like to capture mouse events such as clicking in general, not only inside my window. I have tried the API command GetAsyncKeyState(2) (rightmouse down) but it would only work inside my own window as well.
Thanks in advance!
fenyctis
Capturing mouse events
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
I'd avoid threads if you don't need them. All you need to really do here is drop the wait from your windowevent check.
Code: Select all
.
.
Event = WindowEvent() ; not WaitWindowEvent() !
If Event
TurnPurple
Else
If GetAsyncKeyState(#PB_VerySpecificKey) ;numbers alone are less readable later
BlinkTwiceRapidly
ClearYourThroatLoudly
Else
Delay (10)
Endif
Endif
; Note: Some syntax in this program will not be available until PB 4.x
BERESHEIT
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Code: Select all
eid.l = WindowEvent()
If eid
If eid = #PB_Event_CLosewindow
quit = 1
EndIf
Else
If GetAsyncKeyState_(#VK_LBUTTON)
leftmousepressed = 1
Else
If leftmousepressed = 1
TriggerMouseReleaseAndBounceAround
leftmousepressed = 0
EndIf
EndIf
EndIf