This topic has not yet been rated - Rate this topic

WTSWaitSystemEvent function

Applies to: desktop apps only

Waits for a Remote Desktop Services event before returning to the caller.

Syntax

BOOL WTSWaitSystemEvent(
  __in   HANDLE hServer,
  __in   DWORD EventMask,
  __out  DWORD *pEventFlags
);

Parameters

hServer [in]

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.

EventMask [in]

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.

ValueMeaning
WTS_EVENT_ALL

Wait for any event type.

WTS_EVENT_CONNECT

A client connected to a WinStation.

WTS_EVENT_CREATE

A new WinStation was created.

WTS_EVENT_DELETE

An existing WinStation was deleted.

WTS_EVENT_DISCONNECT

A client disconnected from a WinStation.

WTS_EVENT_LICENSE

The Remote Desktop Services' license state changed. This occurs when a license is added or deleted using License Manager.

WTS_EVENT_LOGOFF

A user logged off from either the Remote Desktop Services console or from a client WinStation.

WTS_EVENT_LOGON

A user logged on to the system from either the Remote Desktop Services console or from a client WinStation.

WTS_EVENT_RENAME

An existing WinStation was renamed.

WTS_EVENT_STATECHANGE

A WinStation connection state changed. For a list of connection states, see the WTS_CONNECTSTATE_CLASS enumeration type.

 

pEventFlags [out]

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 table, or it can be WTS_EVENT_NONE if the wait terminated because of a WTSWaitSystemEvent call with WTS_EVENT_FLUSH.

Return value

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.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Wtsapi32.h

Library

Wtsapi32.lib

DLL

Wtsapi32.dll

See also

WTSOpenServer

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
WTSWaitSystemEvent under Vista (without SP1)
http://support.microsoft.com/kb/941561

Quote:
"On a Windows Vista-based computer, you develop an application by using the WTSWaitSystemEvent function. When you set the value of the EventMask parameter to WTS_EVENT_FLUSH, all pending WTSWaitSystemEvent function calls on the specified terminal server handle are returned. However, no pending calls to the WTSWaitSystemEvent function return as expected.
..."