|
-
Nov 27th, 2000, 05:50 AM
#1
Thread Starter
Junior Member
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
Lars Jarle Mæhlum
http://www.touch-it.no
-
Nov 27th, 2000, 05:55 AM
#2
Frenzied Member
You can use the :
Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
'usage
SendKeys "{TAB}"
Sleep 2000 '2 seconds
SendKeys "{TAB}"
-
Nov 27th, 2000, 05:56 AM
#3
transcendental analytic
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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 27th, 2000, 06:30 AM
#4
PowerPoster
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]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|