Help Center

AfxRunfunction

Runs a program in a new process.

Windowsfunctiondocumented

Syntax

PRIVATE FUNCTION AfxRun (BYREF wszCommand AS WSTRING, BYVAL WindowStyle AS LONG = 0, BYVAL WaitOnReturn AS BOOLEAN = FALSE) AS HRESULT

Parameters

NameDescription
wszCommandString value indicating the command line you want to run. You must include any parameters you want to pass to the executable file.
WindowStyleInteger value indicating the appearance of the program's window. Note that not all programs make use of this information.
WaitOnReturnBoolean value indicating whether the script should wait for the program to finish executing before continuing to the next statement in your script. If set to true, script execution halts until the program finishes, and Run returns any error code returned by the program. If set to false (the default), the Run method returns immediately after starting the program, automatically returning 0 (not to be interpreted as an error code).

Return value

Returns S_OK or an HRESULT error code.

Description

Runs a program in a new process.

Examples

AfxRun (BYREF wszCommand AS WSTRING, BYVAL WindowStyle AS LONG = 0, BYVAL WaitOnReturn AS BOOLEAN = FALSE) AS HRESULT

AfxRun("Calc")

Reference

  • Defined in AfxNova/AfxWsh.inc:196
  • Documented in Windows/Windows Script/Windows Shell.md
  • Topic: Windows Shell