Click to See Complete Forum and Search --> : Mouse
TiPeRa
May 2nd, 2001, 01:15 PM
How do you detect mouse click and send mouse clicks?
Thanks.
Vlatko
May 2nd, 2001, 01:25 PM
On your own form you use the click event.
Vlatko
May 2nd, 2001, 01:26 PM
Ah yeah, To send them use
'Before you start this program, I suggest you save everything that wasn't saved yet.
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Private Sub Form_Activate()
Do
'Simulate a mouseclick on the cursor's position
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
DoEvents
Loop
End Sub
TiPeRa
May 2nd, 2001, 01:40 PM
How do I detect a click outside of my form?
amitabh
May 2nd, 2001, 02:35 PM
You will have to use subclassing. And as far as i know, to subclass external apps, you need to have standard dll's which cannot be created by VB
Megatron
May 2nd, 2001, 04:42 PM
The messages you would have to subclass are: WM_LBUTTONDOWN and WM_LBUTTONUP for the left button, and WM_RBUTTONDOWN, and WM_RBUTTON up for the right button.
Megatron
May 2nd, 2001, 04:45 PM
Another method to SEND mouse clicks is via the PostMessage API function.
PostMessage hWnd_of_Window, WM_LBUTTONDOWN, 1, 0
PostMessage hWnd_of_Window, WM_LBUTTONUP, 1, 0
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.