[Overview][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'process' (#fcl)

TProcess

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Class to start and control other processes.

Declaration

Source position: process.pp line 50

type TProcess = class(TComponent)

protected

  FRunning: Boolean;

  FExitCode: Cardinal;

  FInputStream: TOutputPipeStream;

  FOutputStream: TInputPipeStream;

  FStderrStream: TInputPipeStream;

  procedure CloseProcessHandles; virtual;

  procedure CreateStreams(); virtual;

  procedure FreeStream();

  procedure Loaded; override;

public

  constructor Create(); override;

  

Create a new instance of the TProcess class.

  destructor Destroy; override;

  

Destroy this instance of TProcess

  procedure Execute; virtual;

  

Execute the program with the given options

  procedure CloseInput; virtual;

  

Close the input stream of the process

  procedure CloseOutput; virtual;

  

Close the output stream of the process

  procedure CloseStderr; virtual;

  

Close the error stream of the process

  function Resume; virtual;

  

Resume execution of a suspended process

  function Suspend; virtual;

  

Suspend a running process

  function Terminate(); virtual;

  

Terminate a running process

  function WaitOnExit;

  

Wait for the program to stop executing.

  WindowRect: Trect;

  

Positions for the main program window.

  Handle: THandle;

  

Handle of the process

  ProcessHandle: THandle;

  

Alias for Handle

  ThreadHandle: THandle;

  

Main process thread handle

  ProcessID: Integer;

  

ID of the process.

  ThreadID: Integer;

  

ID of the main process thread

  Input: TOutputPipeStream;

  

Stream connected to standard input of the process.

  Output: TInputPipeStream;

  

Stream connected to standard output of the process.

  Stderr: TInputPipeStream;

  

Stream connected to standard diagnostic output of the process.

  ExitStatus: Integer;

  

Exit status of the process.

  InheritHandles: Boolean;

  

Should the created process inherit the open handles of the current process.

  OnForkEvent: TProcessForkEvent;

  

Event triggered after fork occurred on Linux

published

  PipeBufferSize: Cardinal;

  Active: Boolean;

  

Start or stop the process.

  ApplicationName: ;

  

Name of the application to start (deprecated)

  CommandLine: ;

  

Command-line to execute (deprecated)

  Executable: ;

  

Executable name. Supersedes CommandLine and ApplicationName.

  Parameters: TStrings;

  

Command-line argumens. Supersedes CommandLine.

  ConsoleTitle: ;

  

Title of the console window

  CurrentDirectory: ;

  

Working directory of the process.

  Desktop: ;

  

Desktop on which to start the process.

  Environment: TStrings;

  

Environment variables for the new process

  Options: TProcessOptions;

  

Options to be used when starting the process.

  Priority: TProcessPriority;

  

Priority at which the process is running.

  StartupOptions: TStartupOptions;

  

Additional (Windows) startup options

  Running: Boolean;

  

Determines wheter the process is still running.

  ShowWindow: TShowWindowOptions;

  

Determines how the process main window is shown (Windows only)

  WindowColumns: Cardinal;

  

Number of columns in console window (windows only)

  WindowHeight: Cardinal;

  

Height of the process main window

  WindowLeft: Cardinal;

  

X-coordinate of the initial window (Windows only)

  WindowRows: Cardinal;

  

Number of rows in console window (Windows only)

  WindowTop: Cardinal;

  

Y-coordinate of the initial window (Windows only)

  WindowWidth: Cardinal;

  

Height of the process main window (Windows only)

  FillAttribute: Cardinal;

  

Color attributes of the characters in the console window (Windows only)

  XTermProgram: ;

  

XTerm program to use (unix only)

end;

Inheritance

TProcess

  

Class to start and control other processes.

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent,IFPObserved

|

TObject

Description

TProcess is a component that can be used to start and control other processes (programs/binaries). It contains a lot of options that control how the process is started. Many of these are Win32 specific, and have no effect on other platforms, so they should be used with care.

The simplest way to use this component is to create an instance, set the CommandLine property to the full pathname of the program that should be executed, and call Execute. To determine whether the process is still running (i.e. has not stopped executing), the Running property can be checked.

More advanced techniques can be used with the Options settings.

See also

Create

  

Create a new instance of the TProcess class.

Execute

  

Execute the program with the given options

Running

  

Determines wheter the process is still running.

CommandLin

  

Command-line to execute (deprecated)

Options

  

Options to be used when starting the process.

This page is hosted on Get Lazarus Code and Component Repository at SourceForge.net. Fast, secure and Free Open Source software downloads