-
Click action
I need to create a code that will simulate a mouse click, an actual mouse click.
For example, I want the mouse to click every n seconds, and I want to do it where ever the mouse is, on a VB app or not. I’m emphasizing, an actual mouse click just as if some one is physically clicking the mouse button.
Any one have any ideas?.
If you can please email me your idea to [email protected]
Thanks.
Lee
-
Re: Click action
try the Mouse_Event API, ie.
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 Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
private Sub Form_Load()
Timer1.Interval = 100
End Sub
private Sub Timer1_Timer()
static sTimer as Single
If sTimer = 0 then sTimer = Timer
If (Timer - sTimer) > 5 then
sTimer = Timer
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
End If
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Re: Click action
Thank you very much, this is just what I was looking for.
Thanks.
-
Re: Click action
I know this might be stupid question but I just wanted to know.....why in the hell would you want your mouse to click every second? LOL