Launch files and programs from your code using Delphi. ShellExecute(Handle, ‘open’,”,nil,nil, SW_SHOWNORMAL);. If that option is disabled (the default setting), ShellExecute uses an open Explorer window rather than launch a new one. If no Explorer window. The open verb is a good example, as it is commonly supported. When you use ShellExecute or ShellExecuteEx to open file.
|Published (Last):||28 October 2016|
|PDF File Size:||1.20 Mb|
|ePub File Size:||3.78 Mb|
|Price:||Free* [*Free Regsitration Required]|
A handle to the parent window used for displaying a UI or error messages. This value can be NULL if the operation is not associated with a window. A pointer to a null -terminated string, referred to in this case as a verbthat shellezecute the action to be performed. The set of available verbs depends on the particular file or folder.
Generally, the actions shellexeccute from an object’s shortcut menu are available verbs.
Embarcadero: Delphi FAQ
The following verbs are commonly used:. Launches an editor and opens the document for editing. If lpFile is not a document shellexdcute, the shelllexecute will fail. Prints the file specified by lpFile. If lpFile is not a document file, the function fails. The default verb is used, if available. If not, the “open” verb is used. If neither verb is available, the system uses the first verb listed in the registry. A pointer to a null -terminated string that specifies the file or object on which to execute the specified verb.
To specify a Shell namespace object, pass the fully qualified parse name. Note that not all verbs are supported on all objects.
For example, not all document types support the “print” verb. If a relative path is used for the lpDirectory parameter do not use a relative path for lpFile.
If lpFile specifies an executable file, this parameter is a pointer to a null -terminated string that specifies the parameters to be passed to the application.
The format of this string is determined by the verb that is to be invoked. A pointer to a null -terminated string that specifies the default working directory for the action. If this value is NULLthe current working directory is used.
If a relative path is provided at lpFiledo not use a relative path for lpDirectory. The flags that specify how an application is to be displayed when it is opened.
Launching Applications (ShellExecute, ShellExecuteEx, SHELLEXECUTEINFO)
If lpFile specifies a document file, the flag is simply passed to the associated application. It is up to the application to decide how to handle it. These values are defined in Winuser.
Activates and displays the window. If the window is minimized shwllexecute maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window. An application should call ShowWindow with this flag to set the initial show state of its main window. Activates and displays a window. An application should specify this flag when drlphi the window for the first time.
If the function succeeds, it returns a value greater than If the function fails, it returns an error value that indicates the cause of the failure. It can be cast only to an int and compared to either 32 or the following error codes she,lexecute. In that deelphi, COM should be initialized as shown here:. This method allows you to execute any commands in a folder’s shortcut menu or stored in the registry.
To obtain information about the application that is launched as a result of calling ShellExecuteuse ShellExecuteEx. The following verbs are commonly used: The item can be a file or folder. NULL The default verb is used, if available.
LPCTSTR If lpFile specifies an executable file, this parameter is a pointer to a null -terminated string that specifies the parameters to be passed to the application. INT The flags that specify how an application is to be displayed when it is opened. The active window remains active.
ShellExecute in Delphi
Return code Description 0 The operating system is out of memory or resources. This error will also be returned if you attempt to print a file that is not printable. In that case, COM should be initialized as shown here: If that option is disabled the default settingShellExecute uses an open Explorer window rather than launch a new one.
If no Explorer window is open, ShellExecute launches a new one. There is no application associated with the given file name extension.