Does it excist a nice little wait function that makes the program wait for a desired amount of time?
like:
SendKeys "{TAB}"
wait(20000) 'or something like that
SendKeys "{TAB}"
Or do I have to use the timer.
Lars
Printable View
Does it excist a nice little wait function that makes the program wait for a desired amount of time?
like:
SendKeys "{TAB}"
wait(20000) 'or something like that
SendKeys "{TAB}"
Or do I have to use the timer.
Lars
You can use the :
Code:Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'usage
SendKeys "{TAB}"
Sleep 2000 '2 seconds
SendKeys "{TAB}"
There's an api called sleep, which waits the amount of time, also freezing your app from handling all events. If you don't want that you could make a loop with a doevents that exits when a certain amount of time has passed, using either timer function or gettickcount api.
Yes, Kedaman is right Sleep will cause your entire application stop processing any message, So normally I'll do it with the GetTickCount API function call...
Code:Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private t1 As Long
Private t2 As Long
Private Sub Command1_Click()
'usage
SendKeys "{TAB}"
'Delay 2 seconds
t1 = GetTickCount
t2 = 0
Do While t2 - t1 < 2000
t2 = GetTickCount
DoEvents
Loop
SendKeys "{TAB}"
End Sub
[Edited by Chris on 11-27-2000 at 06:32 AM]