Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns if there is an active session on the system without enumerating through the list of sessions. It also does not obtain any extra information from Local Session Manager.
Syntax
BOOL WTSActiveSessionExists(
[out] PBOOL pbActiveSessionExists
);
Parameters
[out] pbActiveSessionExists
A pointer to a boolean value indicating whether an active session exists.
Return value
Returns zero if this function fails. If this function succeeds, a nonzero value is returned.
Remarks
This function only determines if an active session exists. To get a list of sessions and their states, use WTSEnumerateSessions. Many processes running in session 0 use WTSEnumerateSessions to check if an active session exists, or to do things if an active session exists (ie: get user name, session id, etc). Using WTSEnumerateSessions when there are no active sessions is expensive because the entire list of inactive sessions must be enumerated.
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows, version 26100 |
| Header | wtsapi32.h |