Start(RawInfo: IWinShellExecuteInfo);
Start(RawInfo: Prognoz.Platform.Interop.Ui.WinShellExecuteInfo);
RawInfo. Running process information.
The Start method starts the process.
To execute the example, place the components on the form: two Button, two Label, and Timer named Button1, Button2, Label1, and Timer1.
Add links to the Host, Ui, Forms system assemblies.
The example is a handler of the OnClick event for the Button1 component, OnClick for the Button2, OnTimer for the Timer1 component.
Class TESTForm: Form
Button1: Button;
Label1: Label;
Timer1: Timer;
Button2: Button;
Process: IProcess;
Info: IShellExecuteInfo;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
WinInfo: IWinShellExecuteInfo;
WinProc: IWinProcess;
Begin
WinInfo := New WinShellExecuteInfo.Create;
Info := WinInfo;
Info.Directory := "C:\Program Files\Foresight\Foresight Analytics Platform 9.2";
Info.File := "Studio.exe";
WinProc := New WinProcess.Create;
Process := WinProc;
Process.Start(Info);
Timer1.Enabled := True;
End Sub Button1OnClick;
Sub Timer1OnTimer(Sender: Object; Args: IEventArgs);
Begin
If Process <> Null Then
If Not Process.HasExited Then
Label1.Text := "Process is being executed";
Else
Label1.Text := "Process is completed. Exit code(0-Program finished execution;-1-Program is aborted): " + Process.ExitCode.ToString;
End If;
Else
Label1.Text := "Process is not running"
End If;
End Sub Timer1OnTimer;
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
Process.Kill;
End Sub Button2OnClick;
End Class TESTForm;
After executing the example:
Clicking the Button1 button starts Foresight Analytics Platform.
The Label1 component will display messages about application execution state.
Clicking the Button2 button aborts the execution process, and the application shuts down.
See also: