Click to See Complete Forum and Search --> : mouse_event
stever2003
Feb 28th, 2001, 04:25 PM
How do I use the mouse_event API? I can get the declaration and the constants. I need to simulate the click of a mouse so that it would be like the user clicking the mouse. I just need an example of the usage of the API call. Thanks.
This will click the left button.
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)
Private Sub Command1_Click()
mouse_event 6, 0, 0, 0, 0
End Sub
Lord Orwell
Mar 1st, 2001, 04:14 AM
You could do that, but it is bad practice to actually move the user's mouse around screen to click buttons, which the mouse_event does. Instead, get the handle to the object you want to send a click to, and tell it you clicked it with sendmessage.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.