[Overview][Types][Classes][Procedures and functions][Variables][Index] |
[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Class to start and control other processes.
Source position: processbody.inc line 45
type TPROCESS = class(TComponent) |
||
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. |
function ReadInputStream(); |
|
Read available data from input stream |
function RunCommandLoop(); virtual; |
|
Execute command and collect output in strings |
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. |
|
Exit code of the process |
|
property InheritHandles: Boolean; [rw] |
|
Should the created process inherit the open handles of the current process. |
property OnRunCommandEvent: TOnRunCommandEvent; [rw] |
|
Event handler, called when RunCommandLoop is executing |
property RunCommandSleepTime: Integer; [rw] |
|
Sleep time between attempts to collect data |
property OnForkEvent: TProcessForkEvent; [rw] |
|
Event triggered after fork occurred on Linux |
published |
||
property PipeBufferSize: Cardinal; [rw] |
|
Buffer size to be used when using pipes |
property Active: Boolean; [rw] |
|
Start or stop the process. |
property ApplicationName: TProcessString; [rw] deprecated ; |
|
Name of the application to start (deprecated) |
property CommandLine: TProcessString; [rw] deprecated ; |
|
Command-line to execute (deprecated) |
property Executable: TProcessString; [rw] |
|
Executable name. Supersedes CommandLine and ApplicationName. |
property Parameters: TProcessStrings; [rw] |
|
Command-line arguments. Supersedes CommandLine. |
property ConsoleTitle: TProcessString; [rw] |
|
Title of the console window |
property CurrentDirectory: TProcessString; [rw] |
|
Working directory of the process. |
property Desktop: string; [rw] |
|
Desktop on which to start the process. |
property Environment: TProcessStrings; [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 whether 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) |
property XTermProgram: string; [rw] |
|
XTerm program to use (UNIX 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 whether the process is still running. |
|
|
Command-line to execute (deprecated) |
|
|
Options to be used when starting the process. |