WTSOpenServerExA function

Opens a handle to the specified Remote Desktop Session Host (RD Session Host) server or Remote Desktop Virtualization Host (RD Virtualization Host) server.

Syntax

HANDLE WTSOpenServerExA(
  LPSTR pServerName
);

Parameters

pServerName

A pointer to a null-terminated string that contains the NetBIOS name of the server.

Return Value

If the function succeeds, the return value is a handle to the specified server.

If the function fails, it returns an invalid handle. You can test the validity of the handle by using it in another function call.

Remarks

If the server specified by the pServerName parameter is an RD Session Host server, the behavior of this function is identical to that of the WTSOpenServer function.

To work with sessions running on virtual machines on the RD Virtualization Host server on which the calling application is running, specify WTS_CURRENT_SERVER_NAME for the pServerName parameter.

When you have finished using the handle returned by this function, release it by calling the WTSCloseServer function.

Requirements

   
Minimum supported client Windows 7
Minimum supported server Windows Server 2008 R2
Target Platform Windows
Header wtsapi32.h
Library Wtsapi32.lib
DLL Wtsapi32.dll

See Also

WTSCloseServer

WTSOpenServer