WTSWaitSystemEvent function (wtsapi32.h)
Waits for a Remote Desktop Services event before returning to the caller.
BOOL WTSWaitSystemEvent( [in] HANDLE hServer, [in] DWORD EventMask, [out] DWORD *pEventFlags );
Handle to an RD Session Host server. Specify a handle opened by the WTSOpenServer function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the RD Session Host server on which your application is running.
Bitmask that specifies the set of events to wait for. This mask can be WTS_EVENT_FLUSH to cause all pending WTSWaitSystemEvent calls on the specified RD Session Host server handle to return. Or, the mask can be a combination of the following values.
Wait for any event type.
A client connected to a WinStation.
A new WinStation was created.
An existing WinStation was deleted.
A client disconnected from a WinStation.
The Remote Desktop Services' license state changed. This occurs when a license is added or deleted using License Manager.
A user logged off from either the Remote Desktop Services console or from a client WinStation.
A user logged on to the system from either the Remote Desktop Services console or from a client WinStation.
An existing WinStation was renamed.
A WinStation connection state changed. For a list of connection states, see the WTS_CONNECTSTATE_CLASS enumeration type.
Pointer to a variable that receives a bitmask of the event or events that occurred. The returned mask can be a combination of the values from the previous list, or it can be WTS_EVENT_NONE if the wait terminated because of a WTSWaitSystemEvent call with WTS_EVENT_FLUSH.
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
|Minimum supported client||Windows Vista|
|Minimum supported server||Windows Server 2008|