How can you detect whether the current session is a Terminal Services (Remote Desktop) session in a VB6 app?
How can you detect whether the current session is a Terminal Services (Remote Desktop)
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Calling the
GetSystemMetricsfunction with theSM_REMOTESESSIONflag will tell you whether the app is running inside a Terminal Services session.To call that from VB 6, you need to declare it in a module like so:
If you are running inside of a Terminal Services environment, the return value will be non-zero.
…But you should really just fix your centering code, rather than trying to work around it with different behavior depending on whether you’re running inside a Terminal Services session. That’s just going to make more work for you and introduce more bugs. Unfortunately, I can’t tell you what’s wrong with the centering code you’re using without seeing it.