WIN$SHELLEXECUTE

Emulates the ShellExecuteEx() Win32 API function, which performs an operation on a specified file or directory.
Restrictions:
  • WIN$SHELLEXECUTE is available with wrun32.exe and acuthin.exe, but not available with crun32.exe or run32.exe.
  • When using this routine through the thin client, operations are performed only on files local to the client machine. This also means the client must be a Windows machine, while the server may be either Windows or non-Windows.
  • On Windows 11, some applications ignore the window mode requested in the SHOW parameter.
For more information, see the Windows ShellExecuteEx documentation.

Usage

CALL "WIN$SHELLEXECUTE" USING 
    SHOW VERB FILENAME [DIRECTORY] [PARAMETERS] [FMASK] [WaitForResponse]

Parameters

SHOW PIC (99) Specifies how to display a window invoked by a program that processes the given file. See the sample/def/shexec.def file provided in your product installation or the Windows ShellExecuteEx documentation for more information.
VERB (PIC X(n)) Specifies the action to take. See sample/def/shexec.def in your ACUCOBOL-GT installation for more information.
FILENAME (PIC X(n)) Specifies the file or folder on which to act. All arguments passed to the library routine need to be considered as local to the Windows machine.
DIRECTORY (PIC X(nn)) The directory in which to start the application. When missing or NULL, uses the current directory.
PARAMETERS (PIC X (nn)) Specifies required application parameters to pass, if any. When missing or NULL, passes no parameters.
FMASK (Pic X(4) comp-5) Specifies any combination of FMASK flags that must be passed to the ShellExecuteEx Windows API. See the ShellExecuteEx in the Windows documentation for information on valid values and their descriptions. When this parameter is missing or NULL, the default value of 0 is used.
WaitForResponse (Pic 9) Specifies a boolean value indicating whether or not the server should wait for a response from the thin client before continuing. If true, this ensures any error codes from the client side are captured server-side and returned to the COBOL program. A value of 0 (zero) indicates false, and a non-zero value indicates true. When this parameter is missing or NULL, the default is true (recommended). This parameter has no effect outside of the thin client.