Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WAIT command without Keyboard
Message
From
17/12/2013 10:47:52
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 7
Network:
Windows NT
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01590443
Message ID:
01590486
Views:
100
>What is the best way to PAUSE program execution for 1 second at a time, regardless of Keyboard activity?
>I am generating Time Stamps, ,but when keyboard is pressed, the WAIT statement gets bypassed and my Time Stamps repeat.
>
>.
>Thanks
SLEEP.PRG
LPARAMETERS m.tnMilliseconds
DECLARE Sleep IN kernel32 INTEGER m.tnMilliseconds
RETURN Sleep(m.tnMilliseconds)

Anytime you want to make it sleep for 1 second, call sleep(1000). Have sleep.prg in your path at design time. Have sleep.prg in the project by itself so it is called at run time (in the exe) without any need for set procedure. The first time you try to call sleep it will declare the dll and then call the dll. The second time - if you have not released the dll, it will not call sleep.prg at all, but will call the sleep dll directly.

Also this gives you one place and only one place to change how the declare is coded - instead of having many copies of the declare command all throughout your code base(s).
Previous
Reply
Map
View

Click here to load this message in the networking platform