JCL Help: ShellExecAndWait Function
- Project summary
Search in JCL HelpSearch in all projects
Performs an action on a file.
function ShellExecAndWait(const FileName: string; const Parameters: string = ; const Verb: string = ; CmdShow: Integer = SW_SHOWNORMAL; const Directory: string = ): Boolean;
|const FileName: string||Name of the file or object on which to perform the action.|
|const Verb: string =||Specifies the action to be performed. The available verbs depend on the type of object specified in the FileName parameter but some of the more commonly used ones are 'open', 'print' and 'edit'. See the Platform SDK documentation for more information. This parameter defaults to an empty string which causes the default verb to be executed (usually 'open').|
|CmdShow: Integer = SW_SHOWNORMAL||Flags that specify how the application should display when it is opened. See the Platform SDK documentation on ShellExecute for more information. Commonly used values are SW_HIDE and SW_SHOW. This parameter defaults to SW_SHOWNORMAL.|
If the function succeeds it returns True, otherwise it returns False. You can call GetLastError to get more detailed information about the reason of failure.
ShellExexAndWait is a wrapper for the Win32 API function ShellExecuteEx which alleviates some of the complexities of this function by providing defaults for some of its lesser used parameters. This function performs an action specified on a file which can be anything from executing the file to opening it using the associated editor. This routine is identical to ShellExec except that this function waits for the action to be completed. For example, when using this file to open a HTML document, the function will launch the default webbrowser and then wait until the browser terminates, only then will this function call return to its caller.
Contribute to this help topic
This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page