Click to See Complete Forum and Search --> : Click action


highlander
January 13th, 2000, 01:01 PM
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 lsagi@healthstreet.com

Thanks.

Lee

Aaron Young
January 13th, 2000, 01:30 PM
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
ajyoung@pressenter.com
aarony@redwingsoftware.com

highlander
January 13th, 2000, 03:34 PM
Thank you very much, this is just what I was looking for.
Thanks.

AndyK
January 13th, 2000, 06:47 PM
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