A | B | C |  D | E | F |  G | H | I |  J | K | L |  M | N | O |  P | Q | R |  S | T | U |  V | W | X |  Y | Z


The WaitForSingleObject function returns when one of the following occurs:- The specified object is in the signaled state.- The time-out interval elapses.

Declare Function WaitForSingleObject Lib "kernel32" Alias "WaitForSingleObject" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long


Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later


Parameter Information
- hHandle
Identifies the object. For a list of the object types whose handles can be specified, see the following Remarks section.
Windows NT: The handle must have SYNCHRONIZE access. For more information, see Access Masks and Access Rights.

- dwMilliseconds
Specifies the time-out interval, in milliseconds. The function returns if the interval elapses, even if the objectís state is nonsignaled. If dwMilliseconds is zero, the function tests the objectís state and returns immediately. If dwMilliseconds is INFINITE, the functionís time-out interval never elapses.

Return Values
If the function succeeds, the return value indicates the event that caused the function to return.

If the function fails, the return value is WAIT_FAILED. To get extended error information, call GetLastError.

The return value on success is one of the following values:
The specified object is a mutex object that was not released by the thread that owned the mutex object before the owning thread terminated. Ownership of the mutex object is granted to the calling thread, and the mutex is set to nonsignaled.

The state of the specified object is signaled.

The time-out interval elapsed, and the objectís state is nonsignaled.

Last update: 07 April 2006