<-- Previous || Up || Next -->

Sleep Non Blocking Function
Basic Extensions Class

Public Function SleepNonBlocking( _
      Optional ByVal vSeconds As Variant _
    , Optional ByVal vAllowDoEvents As Variant _
    ) As Boolean

Pause for the specified number of seconds without blocking the Windows environment; see the details below.

Summary: This function pauses without blocking the Windows environment. This function either uses the Windows KERNEL32 Sleep function or the Visual Basic DoEvents Statement/Timer Function, depending upon the value of vAllowDoEvents.
If vAllowDoEvents is False, then this function uses the Windows KERNEL32 Sleep function to pause for the specified number of seconds.
If vAllowDoEvents is True, this function calls the Visual Basic DoEvents statement and checks the Visual Basic Timer function in a continuous loop until the specified number of seconds have elapsed. vSeconds will generally be accurate to 1/18 of a second in this case.
Warning: Microsoft strongly recommends against using DoEvents within In-process OLE Servers (such as the 32-bit version of Entisoft Tools). See the Visual Basic 4.0 ReadMe for more details. vAllowDoEvents should almost always be False. vAllowDoEvents can be True when the 32-bit version of this function is used in other contexts, as long as you are aware of the possible consequences that Microsoft warns about.
Example:
    ? Now : ? SleepNonBlocking(5) : ? Now
    5/8/96 1:05:49 AM
    True
    5/8/96 1:05:54 AM
See also:
    SleepBlocking Function
    DoEventsSafe Subroutine
    Sleep Function (Windows KERNEL32 API)
    DoEvents Statement (Visual Basic)
vSeconds: The number of seconds for which the function should pause. Function returns False if vSeconds if Null or cannot be fixed up to a number that is between 0 and 2,147,483. Otherwise, the function pauses for the specified number of seconds then returns True.
v1.3 Change: Removed 16-bit support from this function.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.