Click to See Complete Forum and Search --> : get mouse click?
Caleb
Mar 15th, 2001, 11:07 PM
Can anyone tell me how to use api calls to retrieve the clicking of the mouse? Or is it impossible?
Lord Orwell
Mar 15th, 2001, 11:59 PM
you can detect Mouseclicks pretty easily using a function that you would never think of, due to its name.
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Command1_Click()
Dim KeyState As Integer
Do While DoEvents > 0
KeyState = GetAsyncKeyState(vbKeyLButton)
Debug.Print KeyState
If (KeyState And &HF000) <> 0 Then MsgBox "Mouse1"
KeyState = GetAsyncKeyState(vbKeyRButton)
If (KeyState And &HF000) <> 0 Then MsgBox "Mouse2"
KeyState = GetAsyncKeyState(vbKeyMButton)
If (KeyState And &HF000) <> 0 Then MsgBox "Mouse3"
Loop
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.