1. Home
  2. Computing & Technology
  3. Delphi Programming

Is your Delphi Application Running under Terminal Services as a Remote Session?

By Zarko Gajic, About.com

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;

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?

More Delphi Programming Quick Tips
Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. Delphi 2008 Tips
  7. Is your Delphi Application Running under Terminal Services as a Remote Session?

©2009 About.com, a part of The New York Times Company.

All rights reserved.