FINALLY!
Other solutions only detect whether the system "SUPPORTS" TS but not whether the current session is a TS. I could find no direct reference to detect if a session was being run in a TS session. But after some digging and noggin scratching I came up with this simple function:
DECLARE integer ProcessIdToSessionId IN WIN32API integer, integer @
DECLARE INTEGER GetCurrentProcessId IN WIN32API
local lnProcessid, lnTsSessionid
lnProcessid = GetCurrentProcessId ()
lnTsSessionid = lnProcessid - lnProcessid
=ProcessIdToSessionId(lnProcessid,@lnTsSessionId)
RETURN lnTsSessionid <> 0
Glenn
>Take a look at Thread #
534050.
>
>>Hi All,
>>
>>I am just wondering if anybody knows of a way to detect if a program
>>is being run from a terminal server.
>>
>>Is there an API that can be called or something like that ?
>>
>>TIA for any help
>>
>>Chris.