Puts the current process thread to sleep for the specified number of milliseconds.
WinApi_Sleep(lnMilliseconds, llUseDoEvents)
Parameters
lnMilliseconds
Number of milliseconds to Sleep
llUseDoEvents if .T. this breaks the milliseconds into 100ms chunks in a loop and fires DOEVENTS along with the operation. This will keep the FoxPro UI active and allow FoxPro to fire events during the sleep operation.
Note that this will increase the actual sleep time somewhat (~5% depending on events fired in VFP) so adjust as needed.
Remarks
Don't use
WinApi_Sleep()
for long periods - periods in access of a couple of seconds at most - as it will freeze the main FoxPro UI thread and causes FoxPro to freeze.If you need to wait for a longer period of time use a loop in combination with
DOEVENTS
to force the UI to refresh:FOR lnX = 1 to 100 WinApi_Sleep(100) DOEVENTS ENDFOR
This provides waits while still keeping the FoxPro UI active in the background and lets FoxPro process events
See also:
Class wwAPI© West Wind Technologies, 2023 • Updated: 12/30/18
Comment or report problem with topic