Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can VFP6 run in background?
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00486603
Message ID:
00491153
Views:
11
>Ed, what effectively happens if you stick a DoEvents...EndDo around the sleep() call?
>>Sleep() burns no cycles while the API call is in effect, but VFP won't respond to any UI events in the interval that Sleep() is in effect, either, so you have to decide which is more important, responding to UI events or not eating some CPU cycles while idling along between checks for the file arriving.

Nothing; DOEVENTS() is not a loop call, and doesn't refire on an event occurring when it is not actively executing:
DECLARE INTEGER Sleep IN Win32API INTEGER

DO WHILE .T.
   DOEVENTS()  && check for events - one time only
   =Sleep(24*60*60*1000)  &&  do nothing for 24 hours;  VFP gets no UI events
                          &&  if a Key is pressed 12 hours into this, nothing
                          &&  happens until the Sleep() function expires
   *  Do something
ENDDO
Check the docs on DOEVENTS(); it doesn't do what you think it does.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform