Detecting if a program is being run in terminal services - TechRepublic
Question
February 4, 2009 at 02:52 PM
slayer_

Detecting if a program is being run in terminal services

by slayer_ . Updated 17 years, 4 months ago

Basically I want to know if my program is being run in a terminal server session.

So far, my research has told me that

Const SM_REMOTESESSION As Long = &H1000
Const SM_REMOTECONTROL As Long = &H2001

GetSystemMetrics(SM_REMOTESESSION)
Tells me if your program is running in an RDP session, but not Terminal Server specifc, any RDP session, so not useful.

GetSystemMetrics(SM_REMOTECONTROL)
I have yet to figure out how to get a value from this, I tried on a terminal session and it returned 0, I suspect it has something to do with Controlling someone elses remote session through terminal services. I cannot seem to get this to work to test this, but it is apperently not what I want.

To Summarize, I want to know when My app is running in a terminal session, not just remote desktop. A remote desktop session to a normal machine (IE a workstation) should be different from a terminal session’d RDP. I want to know when its the terminal session under terminal services.

If it helps anyone, I am coding this under VB6 and am fairly skilled with Windows API.

Any help would be appreciated.

This discussion is locked

All Comments