IWinProcess.Start

Fore Syntax

Start(RawInfo: IWinShellExecuteInfo);

Fore.NET Syntax

Start(RawInfo: Prognoz.Platform.Interop.Ui.WinShellExecuteInfo);

Parameters

RawInfo. Started process information.

Description

The Start method starts a process.

Fore Example

Executing the example requires a form with the Button1 button, the Label component named Label1 and a timer named Timer1.

Class TESTForm: Form
    Button1: Button;
    Label1: Label;
    Timer1: Timer;
    Process: IWinProcess;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        Info: IWinShellExecuteInfo;
    Begin
        Info := New WinShellExecuteInfo.Create;
        Info.File := "Excel.exe";
        Process := New WinProcess.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: + Process.ExitCode.ToString;
            End If;
        Else
            Label1.Text := Process is not started;
        End If;
    End Sub Timer1OnTimer;

End Class TESTForm;

Microsoft Excel application starts after starting the form by clicking the Button1 button. The execution status is controlled by the timer procedure. The corresponding message is shown in the Label1 component.

Fore.NET Example

Executing the example requires a .NET form, the Button1 button on the form, the Label component with the Label1 name and a timer with the Timer1 name.

Imports Prognoz.Platform.Interop.Ui;

Public Partial Class TESTForm: Prognoz.Platform.Forms.Net.ForeNetForm
    
    Process: IWinProcess;
    
    Public Constructor TESTForm();
    Begin
        InitializeComponent();
    End Constructor;
    
    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    Var
        Info: WinShellExecuteInfo;
    Begin
        Info := New WinShellExecuteInfoClass();
        Info.File := "Excel.exe";
        Process := New WinProcessClass();
        Process.Start(Info);
        Timer1.Enabled := True;
    End Sub;
    
    Private Sub timer1_Tick(sender: System.Object; e: System.EventArgs);
    Begin
        If Process <> Null Then
            If Not Process.HasExited Then
                Label1.Text := Process is being executed;
            Else
                Label1.Text := Process is completed. Exit code: + Process.ExitCode.ToString();
            End If;
        Else
            Label1.Text := Process is not started;
        End If;
    End Sub;
    
End Class;

Microsoft Excel application starts after starting the form by clicking the Button1 button. The execution status is controlled by the timer procedure. The corresponding message is shown in the Label1 component.

See also:

IWinProcess