JCL Help:ShellExec

From Project JEDI Wiki
Jump to navigationJump to search


Performs an action on a file.


 function ShellExec(Wnd: Integer; const Operation: string; const FileName: string; const Parameters: string; const Directory: string; ShowCommand: Integer): Boolean;


Parameters Description
const FileName: string Name of the file or object on which to perform the action.
Verb 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 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.

Return Value

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.


ShellExec 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.

See Also






Petr Vones

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