TProcess
by Pablo Pissanetzky
pablo@neosoft.com
http://www.neosoft.com/~pablo

TProcess is a simple non-visual component which allows you to launch processes.
It encapsulates the CreateProcess API call.

Methods
-------

procedure Execute;

  Execute actually creates the process. TProcess creates a thread which in turn
  creates the process. This is necessary, because if you set the Wait property
  to True, the thread will wait until the process is complete and thus will not
  hang up your application. See the Wait property below.

Properties
----------

Command : string

  This is the command executed by TProcess. It can be a fully qualified
  executable name with arguments. It can be a DOS command as well.
  For a DOS command, you could enter "command.com /c dir c:\" see the options
  on command.com by typing "command /?" at a DOS prompt.

Directory : string

  This is the startup directory where the process will begin.
  Note that if this directory is invalid, the process will not execute.

ShowWindow : TShowWindow

  TShowWindow = ( swHide , swMaximize , swMinimize , swRestore , swShow ,
    swShowDefault , swShowMaximized , swShowMinimized ,
    swShowMinNoActive , swShowNA , swShowNoActivate , swShowNormal );

  This property determines how the new process' window will be shown. See
  ShowWindow in the Win32 API Reference for more information.

Wait : Boolean

  If set to true, the TProcess thread will wait until the process has finished
  and will generate an OnFinshed event. If it is set to False, the TProces thread
  will simply create the process and terminate ( the thread ) allowing the process
  to run independent of your application. If False, the OnFinished event will
  NOT be triggered.

Events
------

procedure OnFinished( Sender : TObject; ExitCode : DWord );

  This event occurs when the Wait property is set to True and the process
  finishes. The ExitCode parameter gives you the exit code of the process.
  The Sender parameter is the TProcess that generated the event.

Notes
-----

You can use one TProcess component to run many instances of a process as long as
the properties of TProcess remain the same. Since TProcess creates a thread for
each process executed, you could get into trouble otherwise. The rule of thumb
is to use one TProcess component for each "different" process.

Thanks and
Enjoy


by Pablo Pissanetzky
pablo@neosoft.com
http://www.neosoft.com/~pablo


