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.
C++
#include <windows.h>
#pragma comment(lib, "user32.lib")
BOOL IsRemoteSession(void)
{
return GetSystemMetrics( SM_REMOTESESSION );
}