JVCL Help: TJvCreateProcess Class
- Project summary
Search in JVCL HelpSearch in all projects
Enables you to create processes and wait for them to end.
TJvCreateProcess = class(TJvComponent);
Use TJvCreateProcess to start a process or application, and possibly wait for it to terminate.
First use the properties of TJvCreateProcess to specify how and which process must be created:
- SetApplicationName to a string to specify the module to execute.
- SetCommandLine to a string to specify the command line to execute.
- Use WaitForTerminate to specify whether TJvCreateProcess must wait for the process to end. If you set WaitForTerminate to True, specify an OnTerminate event handler to execute code after theprocess finishes executing.
TJvCreateProcess enables you to redirect the standard input and output of console processes it creates. Do this by including coRedirect in ConsoleOptions. After a console process is successfully created, the component will wait for the process to end whether you set WaitForTerminate to True or not.
You might also set the following properties:
- Use StartupInfo to specify the window station, desktop, and appearance of the main window for the new process. Use this property for example to hide a console which standard input and output hasbeen redirected.
- SetCurrentDirectory to a drive and directory to specify another drive and directory for the new process than the current application.
- Use Environment to specify another environment than the current application.
- SetCreationFlags to control the creation of the process.
- SetPriority to specify another priority class for the new process than the default ppNormal.
After setting these properties you can call Run to start the application or process. After successfully creating the new process, you can call CloseApplication or Terminate to stop the application.
If WaitForTerminate is set to True, or coRedirect is included in ConsoleOptions, the component waits for the process to end and then triggers an OnTerminate event.
If you have included coRedirect in ConsoleOptions, and thus the standard input and output of the console process is redirected, then you can call Write or WriteLn to write to the input of the console. Furthermore OnRawRead and OnRead events will be fired if the console outputs some data.
You can stop waiting for the process to end by calling StopWaiting, although this is not recommended if the component has redirected the standard input and output of the console process.
Contribute to this help topic
This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page