Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
Enterprise Services
Terminal Services
 WTSGetActiveConsoleSessionId Functi...
WTSGetActiveConsoleSessionId Function

The WTSGetActiveConsoleSessionId function retrieves the Terminal Services session that is currently attached to the physical console. The physical console is the monitor, keyboard, and mouse. Note that it is not necessary that Terminal Services be running for this function to succeed.

Syntax

DWORD WTSGetActiveConsoleSessionId(void);

Parameters

This function has no parameters.

Return Value

The session identifier of the session that is attached to the physical console. If there is no session attached to the physical console, (for example, if the physical console session is in the process of being attached or detached), this function returns 0xFFFFFFFF.

Remarks

The session identifier returned by this function is the identifier of the current physical console session. To monitor the state of the current physical console session, use the WTSRegisterSessionNotification function.

Requirements

ClientWindows Vista or Windows XP
ServerWindows Server 2008 or Windows Server 2003
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

ProcessIdToSessionId
WM_WTSSESSION_CHANGE
WTSQuerySessionInformation
WTSRegisterSessionNotification


Send comments about this topic to Microsoft

Build date: 10/23/2008

Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker