The Process object provides the following Methods, Properties and Event.
Methods
CloseMainWindow : When a process is executing, its message loop is in a wait state.
The message loop executes every time a Windows message is sent to the process by
the operating system. Calling CloseMainWindow sends a request to close to the main
window, which, in a well-formed application, closes child windows and revokes all
running message loops for the application. The request to exit the process by calling
CloseMainWindow does not force the application to quit. The application can ask for
user verification before quitting, or it can refuse to quit. To force the application to
quit, use the Kill method. The behavior of CloseMainWindow is identical to that of a
user closing an application's main window using the system menu. Therefore, the
request to exit the process by closing the main window does not force the application
to quit immediately. Returns true if the close message was successfully sent; false if
the associated process does not have a main window or if the main window is
disabled (for example if a modal dialog is being shown).
Kill : Kill causes an abnormal process termination and should be used only when
necessary. Data edited by the process or resources allocated to the process can be lost
if you call Kill. CloseMainWindow enables an orderly termination of the process and
closes all windows, so it is preferable for applications with an interface. If
CloseMainWindow fails, you can use Kill to terminate the process. Kill is the only
way to terminate processes that do not have graphical interfaces.
New1 : Creates a new instance of the Process object.
Start(Program As String, Args As String) : Runs the program passing to it the Args
string as its' set of arguments. Returns true if the program was started false if it wasn't
- probably because either a process is already running or the program could not be
located.
Properties
I signifies readable and O signifies settable..
ControlRef : Thread [I] : The underlying .NET Process object. This is not usable in
Basic4PPC code.
DLLversion: Integer [I] : The version number of this library.
ExitCode : Integer [I] : The exit code returned from the last process to terminate. This
is set to 0 when a process is started and to that process' exit code when it terminates.
MainWindowHandle : IntPtr [I] : The MainWindowHandle property is a value that
uniquely identifies the window that is associated with the process. A process has a
main window associated with it only if the process has a graphical interface. If the
associated process does not have a main window, the MainWindowHandle value is
zero. If you have just started a process and want to use its main window handle, you
may have to wait for the process to finish starting, ensuring that the main window
handle has been created. Otherwise, an exception will be thrown. This is not usable
in Basic4PPC code.
Running: Boolean [I] : return true if a process is running.