Title: Is your Delphi Application Running under Terminal Services as a Remote Session?
Windows Terminal Services environment enables users to access Windows-based programs that are installed on a terminal server, or to access the full Windows desktop. Users can connect to a terminal server to run programs, save files, and use network resources on that server.
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;