Detecting the Remote Desktop Services(RDP) Environment

Detect Remote Desktop Services(RDP)

To optimize performance, it is good practice for applications to detect whether they are running in a Remote Desktop Services client session. For example, when an application is running on a remote session, it should eliminate unnecessary graphic effects, as described in Graphic Effects. If the user is running the application in a local environment, it is not as critical for the application to optimize its behavior.

The following example shows a function that returns TRUE if the application is running in a remote session and FALSE if the application is running on the console.

sample code:

#include windows.h

#pragma comment(lib, "user32.lib")

BOOL IsRemoteSession(void)

{

return GetSystemMetrics( SM_REMOTESESSION );

}


ref:


code to detect if an application is running under terminal server -

How to test the reachability of a VPN-Connection? -