Purpose: Executes an executable file.


Properties


  • Name: Program
    • Type: String
    • Direction: in
    • Purpose: File to execute

  • Name: ExecuteAsync
    • Type: Boolean
    • Direction: in
    • Purpose: True if external program should be execute asyncronously, False if the procedure have to wait untill the external program ends.


  • Name: ExecuteOnClientMachine
    • Type: Boolean
    • Direction: in
    • Purpose: True if the program will execute on user machine, False if is execute server-side.

  • Name: NoWindow
    • Type: Boolean
    • Direction: in
    • Purpose: True if the program will execute without a window, False otherwise.

  • Name: Result
    • Type: Int32
    • Direction: out
    • Purpose: Returns the output of the program: 0 if program execution succedes, a different returning values stands by an error code.

  • Name: UseShellExecute
    • Type: Boolean
    • Direction: in
    • Purpose: See remarks for more infos.


  • [optional] Name: StdErr
    • Type: String
    • Direction: InOut
    • Purpose: If present will be filled with program standard error stream. See remarks for more infos.

  • [optional] Name: StdOut
    • Type: String
    • Direction: InOut
    • Purpose: If present will be filled with program standard output stream. See remarks for more infos.



Remark


ShellExecute: Windows has two distinct api function to start a process. ShellExecute and CreateProcess. The high level one is ShellExecute. If a program is started via this function will use the environment variables of the host operating system. It is roughly equivalnt to typing the command to be executed into the run dialog and clicking OK, which means that it can be used to (for example): 


  • Use automatically file associations so you can open .html files or web using the default browser without needing to know what that browser is, or open a word document without needing to know what the installation path for Word is 
  • Run batch files 
  • Run any command on the PATH, 

The main drawback is you can't redirect the standard input / output / error handles. If is necessary to redirect those streams ShellExecute should be se to False so the procedure will use CreateProcess api function. In this case the above use cases wont works.