Parameters: String;
Parameters: String;
The Parameters property determines command line parameters, with which a file or application opens.
To execute the example, place the components on the form: two Button, two Label, and Timer named Button1, Button2, Label1, Label2 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;
Button2: Button;
Label1: Label;
Label2: Label;
Timer1: Timer;
Process: IShellProcess;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Info: IShellExecuteInfo;
Begin
Info := New ShellExecuteInfo.Create;
Info.Directory := "C:\Program Files\Foresight\Foresight Analytics Platform 9.2";
Info.File := "Studio.exe";
Info.Parameters := "Repository/user@password";
Info.WaitToTerminate := True;
Info.WaitTimeout := 10000;
Process := New ShellProcess.Create;
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;
Label2.Text := "Output stream:" + Process.Output + "; " + "Error stream:" + Process.Error;
End If;
Else
Label1.Text := "Process is not started";
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 platform is started with the parameter of auto connection to the Repository repository scheme.
The Label1 component will display messages about application execution state.
The current running application is not available awaiting for ten seconds of its completion. After the specified time, the current application is available for work again.
Clicking the Button2 button aborts the execution process, and the application shuts down.
After the process is finished, the Label2 component displays a message about the output stream and error stream.
See also: