how do i detect whether a mouse is clicked, using API, even if the cursor may not be over a VBform.
please help me out
:confused:
Printable View
how do i detect whether a mouse is clicked, using API, even if the cursor may not be over a VBform.
please help me out
:confused:
Use the GetAsyncKeyState API function.
Code:Private Declare Function GetAsyncKeyState _
Lib "user32.dll" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbLeftButton) Then Msgbox "Left button clicked"
If GetAsyncKeyState(vbMiddleButton) Then Msgbox "Middle button clicked"
If GetAsyncKeyState(vbRightButton) Then Msgbox "Right button clicked"
End Sub