Waits for a API HANDLE on a seperate thread without blocking, when the HANDLE is signaled the supplied callback function is executed.

AsyncWaitForObject(nHandle, cCallback)

Parameters

nHandle

The handle to monitor.

cCallback

The function to call when the handle is signaled.
The function should have the following prototype:

FUNCTION ObjectSignaled
    LPARAMETERS nError
    IF nError = 0
        ? 'Object signaled'
    ELSE
        ? 'Function: WaitForMultipleObjects failed with error', nError
    ENDIF		
ENDFUNC

Return Value

A handle (numeric) to the created thread.

See Also

Reference

BindEventsEx
CancelWaitForObject
CreateCallbackFunc
CreatePublicShadowObjReference
DestroyCallbackFunc
ReleasePublicShadowObjReference
UnbindEventsEx

Used WinApi functions

WaitForMultipleObjects
CreateEvent
CreateThread
CloseHandle
PostMessage