The SDK shows the following prototype for use in determining whether or not you are running on Terminal Services:
BOOL IsRemoteSession(void)
{
return GetSystemMetrics( SM_REMOTESESSION );
}
| SM_REMOTECONTROL | Windows XP: This system metric is used in a Terminal Services environment. Its value is TRUE if the current session is remotely controlled; FALSE otherwise. |
| SM_REMOTESESSION | Windows NT 4.0 SP4 and later: This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is TRUE or nonzero. If the calling process is associated with the Terminal Server console session, the return value is zero. |
Public Declare Function GetSystemMetrics Lib "wtsapi32" (ByVal metric) As Long
Public CONST SM_REMOTESESSION As Long = &H1000
Public CONST SM_REMOTECONTROL 0x2001