TProcess class
Class to start and control other processes.
Declaration
TProcess = class(TComponent)Inheritance
- TProcess
- TComponent
- TPersistent
- TObject
Descends from it: TProcessUTF8
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
Properties
WindowRect | public | Positions for the main program window. |
Handle | public | Handle of the process. |
ProcessHandle | public | Alias for Handle. |
ThreadHandle | public | Main process thread handle. |
ProcessID | public | ID of the process. |
ThreadID | public | ID of the main process thread. |
Input | public | Stream connected to standard input of the process. |
Output | public | Stream connected to standard output of the process. |
Stderr | public | Stream connected to standard diagnostic output of the process. |
ExitStatus | public | Exit status of the process. |
ExitCode | public | Exit code of the process. |
InheritHandles | public | Should the created process inherit the open handles of the current process. |
RunCommandSleepTime | public | Sleep time between attempts to collect data. |
PipeBufferSize | published | Buffer size to be used when using pipes. |
Active | published | Start or stop the process. |
ApplicationName | published | Name of the application to start (deprecated). |
CommandLine | published | Command-line to execute (deprecated). |
Executable | published | Executable name. Supersedes CommandLine and ApplicationName. |
Parameters | published | Command-line arguments. Supersedes CommandLine. |
ConsoleTitle | published | Title of the console window. |
CurrentDirectory | published | Working directory of the process. |
Desktop | published | Desktop on which to start the process. |
Environment | published | Environment variables for the new process. |
Options | published | Options to be used when starting the process. |
Priority | published | Priority at which the process is running. |
StartupOptions | published | Additional (Windows) startup options. |
Running | published | Determines whether the process is still running. |
ShowWindow | published | Determines how the process main window is shown (Windows only). |
SkipCommandLineQuotes | published | |
WindowColumns | published | Number of columns in console window (windows only). |
WindowHeight | published | Height of the process main window. |
WindowLeft | published | X-coordinate of the initial window (Windows only). |
WindowRows | published | Number of rows in console window (Windows only). |
WindowTop | published | Y-coordinate of the initial window (Windows only). |
WindowWidth | published | Height of the process main window (Windows only). |
FillAttribute | published | Color attributes of the characters in the console window (Windows only). |
XTermProgram | published | XTerm program to use (UNIX only). |
InputDescriptor | published | |
OutputDescriptor | published | |
ErrorDescriptor | published |
Methods
CloseProcessHandles | protected | |
Loaded | protected | Called when the component has finished loading. |
SysExecute | protected | |
CreateIODescriptor | protected | |
Create | public | Create a new instance of the TProcess class. |
Destroy | public | Destroy this instance of TProcess. |
Execute | public | Execute the program with the given options. |
CloseInput | public | Close the input stream of the process. |
CloseOutput | public | Close the output stream of the process. |
CloseStderr | public | Close the error stream of the process. |
Resume | public | Resume execution of a suspended process. |
Suspend | public | Suspend a running process. |
Terminate | public | Terminate a running process. |
WaitOnExit | public | Wait for the program to stop executing. |
ReadInputStream | public | Read available data from input stream. |
RunCommandLoop | public | Execute command and collect output in strings. |
Events
OnRunCommandEvent | public | Event handler, called when RunCommandLoop is executing. |
OnForkEvent | public | Event triggered after fork occurred on Linux. |
Fields
FRunning | protected | |
FExitCode | protected | |
FProcessID | protected | |
FThreadID | protected | |
FProcessHandle | protected | |
FThreadHandle | protected |
Inherited
From TComponent (73)
_AddRef _Release BeforeDestruction CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DefineProperties DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetChildren GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetParentComponent GetTypeInfo GetTypeInfoCount HasParent iicrGetComponent InsertComponent Invoke IsImplementorOf Loading Name Notification ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReadState ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetName SetParentComponent SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState
From TPersistent (5)
Assign AssignTo FPOAttachObserver FPODetachObserver FPONotifyObservers
From TObject (37)
AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
