quote:
Originally posted by Matty.
A do while loop with doevents in the middle
That doesn't sound good Matty...
Well, TheCodeSmith, search for APIs about SetTimer and callback functions
For example...
code:
Public Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Public TimerEvent As Long
code:
TimerEvent = SetTimer(0, 0, 5000, AddressOf TimerProc_Process) 'Set a timer to fire after 5 seconds - it calls TimerProc_Process on firing
code:
Public Sub TimerProc_Process(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
'Do something you want
End Sub
You need to kill the timer using this when you no longer needs it.
code:
KillTimer 0, TimerEvent
TimerProc_Process will be triggered every 5 seconds.