Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
 WTSDisconnectSession Function

  Switch on low bandwidth view
WTSDisconnectSession Function

The WTSDisconnectSession function disconnects the logged-on user from the specified Remote Desktop Services session without closing the session. If the user subsequently logs on to the same Remote Desktop Session Host (RD Session Host) server, the user is reconnected to the same session.

Syntax

C++
BOOL WTSDisconnectSession(
  __in  HANDLE hServer,
  __in  DWORD SessionId,
  __in  BOOL bWait
);

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.

SessionId [in]

A Remote Desktop Services session identifier. To indicate the current session, specify WTS_CURRENT_SESSION. To retrieve the identifiers of all sessions on a specified RD Session Host server, use the WTSEnumerateSessions function.

To be able to disconnect another user's session, you need to have the Disconnect permission. For more information, see Remote Desktop Services Permissions. To modify permissions on a session, use the Remote Desktop Services Configuration administrative tool.

bWait [in]

Indicates whether the operation is synchronous. Specify TRUE to wait for the operation to complete, or FALSE to return immediately.

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 clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWtsapi32.h
LibraryWtsapi32.lib
DLLWtsapi32.dll

See Also

WTSEnumerateSessions

Send comments about this topic to Microsoft

Build date: 6/26/2009

Tags What's this?: Add a tag
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