Hey Matt, yes you are right, the problem is that you have
to call the mouse_event procedure every 30 seconds.
As your program is at the moment, mouse_event is only called once just as the program is starting, because you only call it in the form_load procedure.
Probably the easiest way to call mouse_event every 30 seconds is to use a timer.
Just put a timer control on your form - doesn't matter
where you put it, as it's invisible when the program
is run.
When using a timer you have to set the timer interval.
and enable the timer when you want it to start.
If you want to start clicking as soon as your program
starts, enable the timer in the form_load procedure.
Private Sub Form_Load()
Timer1.Interval = 30000
Timer1.Enabled = True
End Sub
Setting Timer1.Interval = 30000 means that every 30000 milliseconds (every 30 seconds) a procedure called
Timer1.Timer will be called.
So this procedure is where you want to call the mouse_event.
Private Sub Timer1_Timer()
mouse_event MOUSEEVENTF_LEFTDOWN,0,0,0,0,
mouse_event MOUSEEVENTF_LEFTUP,0,0,0,0
End Sub
I wouldn't worry about the getextrainfo procedure
I don't think you need it.
And you will need to add this constant to your module
Public Const MOUSEEVENTF_LEFTDOWN = &H2
So all that should be in your module is this:
Option Explicit
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public 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)
Public Declare Function GetMessageExtraInfo Lib "user32" () As Long
Ok, hope this helps
It's important not to use code you don't understand,
so feel free to ask for further explanation :-Q