WM_WTSSESSION_CHANGE message

Notifies applications of changes in session state.

The window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(
  HWND hWnd,       // handle to window
  UINT Msg,        // WM_WTSSESSION_CHANGE
  WPARAM wParam,   // session state change event
  LPARAM lParam    // session ID
);

Parameters

hWnd [in]

Handle to the window.

Msg [in]

Specifies the message (WM_WTSSESSION_CHANGE).

wParam [in]

Status code describing the reason the session state change notification was sent. This parameter can be one of the following values.

WTS_CONSOLE_CONNECT (0x1)

The session identified by lParam was connected to the console terminal or RemoteFX session.

WTS_CONSOLE_DISCONNECT (0x2)

The session identified by lParam was disconnected from the console terminal or RemoteFX session.

WTS_REMOTE_CONNECT (0x3)

The session identified by lParam was connected to the remote terminal.

WTS_REMOTE_DISCONNECT (0x4)

The session identified by lParam was disconnected from the remote terminal.

WTS_SESSION_LOGON (0x5)

A user has logged on to the session identified by lParam.

WTS_SESSION_LOGOFF (0x6)

A user has logged off the session identified by lParam.

WTS_SESSION_LOCK (0x7)

The session identified by lParam has been locked.

WTS_SESSION_UNLOCK (0x8)

The session identified by lParam has been unlocked.

WTS_SESSION_REMOTE_CONTROL (0x9)

The session identified by lParam has changed its remote controlled status. To determine the status, call GetSystemMetrics and check the SM_REMOTECONTROL metric.

WTS_SESSION_CREATE (0xA)

Reserved for future use.

WTS_SESSION_TERMINATE (0xB)

Reserved for future use.

lParam [in]

The identifier of the session.

Return value

The return value is ignored.

Remarks

This message is sent only to applications that have registered to receive this message by calling WTSRegisterSessionNotification.

Examples of how applications can respond to this message include releasing or acquiring console-specific resources, determining how a screen is to be painted, or triggering console animation effects.

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Winuser.h (include Windows.h)

See also

WTSRegisterSessionNotification

WTSUnRegisterSessionNotification