[Overview][Types][Classes][Index] |
[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Class to start and control other processes.
Source position: process.pp line 44
type TProcess = class(TComponent) |
||
protected |
||
FRunning: Boolean; |
||
procedure CloseProcessHandles; virtual; |
||
procedure CreateStreams(); virtual; |
||
procedure FreeStream(); |
||
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. |
property WindowRect: Trect; [rw] |
|
Positions for the main program window. |
|
Handle of the process |
|
property ProcessHandle: THandle; [r] |
|
Alias for Handle |
property ThreadHandle: THandle; [r] |
|
Main process thread handle |
|
ID of the process. |
|
|
ID of the main process thread |
|
property Input: TOutputPipeStream; [r] |
|
Stream connected to standard input of the process. |
property Output: TInputPipeStream; [r] |
|
Stream connected to standard output of the process. |
property Stderr: TInputPipeStream; [r] |
|
Stream connected to standard diagnostic output of the process. |
property ExitStatus: Integer; [r] |
|
Exit status of the process. |
property InheritHandles: Boolean; [rw] |
|
Should the created process inherit the open handles of the current process. |
published |
||
property Active: Boolean; [rw] |
|
Start or stop the process. |
property ApplicationName: String; [rw] |
|
Name of the application to start |
property CommandLine: String; [rw] |
|
Command-line to execute |
property ConsoleTitle: String; [rw] |
|
Title of the console window |
property CurrentDirectory: String; [rw] |
|
Working directory of the process. |
property Desktop: String; [rw] |
|
Desktop on which to start the process. |
property Environment: TStrings; [rw] |
|
Environment variables for the new process |
property Options: TProcessOptions; [rw] |
|
Options to be used when starting the process. |
property Priority: TProcessPriority; [rw] |
|
Priority at which the process is running. |
property StartupOptions: TStartupOptions; [rw] |
|
Additional (Windows) startup options |
property Running: Boolean; [r] |
|
Determines wheter the process is still running. |
property ShowWindow: TShowWindowOptions; [rw] |
|
Determines how the process main window is shown (Windows only) |
property WindowColumns: Cardinal; [rw] |
|
Number of columns in console window (windows only) |
property WindowHeight: Cardinal; [rw] |
|
Height of the process main window |
property WindowLeft: Cardinal; [rw] |
|
X-coordinate of the initial window (Windows only) |
property WindowRows: Cardinal; [rw] |
|
Number of rows in console window (Windows only) |
|
Y-coordinate of the initial window (Windows only) |
|
property WindowWidth: Cardinal; [rw] |
|
Height of the process main window (Windows only) |
property FillAttribute: Cardinal; [rw] |
|
Color attributes of the characters in the console window (Windows only) |
end; |
|
Class to start and control other processes. |
|
| | ||
| | ||
| | ||
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.
|
Create a new instance of the TProcess class. |
|
|
Execute the program with the given options |
|
|
Determines wheter the process is still running. |
|
|
Command-line to execute |
|
|
Options to be used when starting the process. |
lazarus-ccr.sourceforge.net |