 |
WTSQuerySessionInformation ..msdn Add comment W32 Constants Translate this page |
 |
 |
Retrieves session information for the specified session on the specified terminal server. It can be used to query session information on local and remote terminal servers.
|
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
BOOL WTSQuerySessionInformation(
HANDLE hServer,
DWORD SessionId,
WTS_INFO_CLASS WTSInfoClass,
LPTSTR* ppBuffer,
DWORD* pBytesReturned
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER WTSQuerySessionInformationA IN Wtsapi32;
AS WTSQuerySessionInformation;
INTEGER hServer,;
LONG SessionId,;
INTEGER WTSInfoClass,;
INTEGER @ppBuffer,;
LONG @pBytesReturned
|
 |
 |
 |
| Parameters: |
 |
hServer
[in] Handle to a terminal server.
SessionId
[in] A Terminal Services session identifier.
WTSInfoClass
[in] Specifies the type of information to retrieve.
ppBuffer
[out] Pointer to a variable that receives a pointer to the requested information.
pBytesReturned
[out] Pointer to a variable that receives the size, in bytes, of the data returned in ppBuffer.
|
 |
 |
| Return value: |
 |
| If the function succeeds, the return value is a nonzero value. |
 |
 |
| Usage: |
 |
LOCAL hBuffer, nBufsize, nResult, cBuffer
STORE 0 TO hBuffer, nBufsize
* 6=WTSWinStationName
nResult = WTSQuerySessionInformation(m.hServer,;
nSessionId, 6, @hBuffer, @nBufsize)
IF hBuffer <> 0
cBuffer = REPLICATE(CHR(0), nBufsize)
= MemToStr(@cBuffer, hBuffer, nBufsize)
? "[" + m.cBuffer + "]"
= WTSFreeMemory(m.hBuffer)
ENDIF
|
 |
 |
| My comment: |
 |
For hServer, specify a handle opened by the WTSOpenServer function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the terminal server on which your application is running.
To free the returned buffer, call the WTSFreeMemory function.
|
 |
 |
| Word Index links for the WTSQuerySessionInformation : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2007-06-08 16:29:12 | | Modified: | 2007-06-11 16:19:58 | Visited in last 7 days: 14 |