Location: Symbol Reference > Classes > TJwTerminalServer Class > TJwTerminalServer Methods > EnumerateProcesses Method > TJwTerminalServer.EnumerateProcesses Method ()
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwTerminalServer.EnumerateProcesses Method ()
Pascal
function EnumerateProcesses: Boolean; overload;

EnumerateProcesses enumerates all processes on the Terminal Server and fills the Processes property with a TJwProcessList. This list contains all processes and their properties such as Process Name, Process Id, Username, Memory Usage and so on. 

This method can only be used on Windows XP or newer. Windows 2000 Server (with Terminal Server) is also supported but not Windows 2000 Workstation.

 var
  ATerminalServer: TJwTerminalServer;
  i: Integer;
begin
  // Create Terminal Server instance and allocate memory for it
  ATerminalServer := TjwTerminalServer.Create;

  // Set servername (only in case of remote server)
  ATerminalServer.Server := 'TS001';

  // Remember that EnumerateProcesses will automatically connect to the
  // Terminal Server for you. The connect function raises an Exception
  // if the connection attempt was unsuccessfull, so better use try..except
  try
    if ATerminalServer.EnumerateProcesses then
    begin

      // Now loop through the list
      for i := 0 to ATerminalServer.Processes.Count - 1 do
      begin
        Memo1.Lines.Add(ATerminalServer.Processes[i].ProcessName);
      end;

    end;
  except
    on E: EJwsclWinCallFailedException do
    begin
      // Handle Exception here
    end;
  end;

  // Free Memory
  ATerminalServer.Free;
end;

 

Check for a nil property value Processes

Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!