-
WTS API Call
To my knowledge, the API routines for Windows Terminal Server are not documented on allapi.net. I can call some of them from VB, but I can' get WTSQuerySessionInformation to work. I think it might have something to do with the enum field you have to pass it, WTS_INFO_CLASS. Maybe VB doesn't pass enum fields to C. Has anybody called this routine successfully?
Thanks,
Ken
-
Enums in start counting from zero, they are passed ByVal as Integer. Start with the first one - it's zero, the next one in the enum is 1, next 2, etc.
Here is the enum:
Code:
typedef enum _WTS_INFO_CLASS {
WTSInitialProgram, 0
WTSApplicationName, 1
WTSWorkingDirectory, 2 ,etc.
WTSOEMId,
WTSSessionId,
WTSUserName,
WTSWinStationName,
WTSDomainName,
WTSConnectState,
WTSClientBuildNumber,
WTSClientName,
WTSClientDirectory,
WTSClientProductId,
WTSClientHardwareId,
WTSClientAddress,
WTSClientDisplay,
WTSClientProtocolType
}
WTS_INFO_CLASS;
Pick one of the values, eg.:
Const WTSWorkingDirectory = 2
and pass it as a constant ByVal.
-
Re: Api Call
Must be something else wrong. Still get a "false" on the return status from the call, but GetLastError returns a 0. I found a chunk of sample code on a microsoft.public newsgroup which I'm going to try.