There might be situations when you need to know if your Delphi application is running under terminal services - usually using the Remote Desktop connection.
Running under Terminal Services?
Here's a handy Delphi function using the GetSystemMetrics API call to test if the process is associated with a Terminal Services client session.//returns true if running under Windows Terminal Services
function TRemoteSession.IsRemoteSession: boolean;
(*
const
sm_RemoteSession = $1000;
*)
begin
result := GetSystemMetrics(sm_RemoteSession) <> 0;
end;
Delphi tips navigator:
» Prevent the System from Entering Sleep or Turning off the Display
« Need to Return a TStringList (any object) from a Delphi Function?

