HANDLE ShellExecute(hwnd, lpszOp, lpszFile, lpszParams, lpszDir, wShowCmd) | |||||
HWND hwnd; | /* handle of parent window | */ | |||
LPSTR lpszOp; | /* pointer to string for operation to perform | */ | |||
LPSTR lpszFile; | /* pointer to string for filename | */ | |||
LPSTR lpszParams; | /* pointer to string for executable file parameters | */ | |||
LPSTR lpszDir; | /* pointer to string for default directory | */ | |||
WORD wShowCmd; | /* whether file is shown when opened | */ |
The ShellExecute function opens or prints the specified file.
hwnd
Identifies the parent window. This window receives any message boxes an application produces; for example, for error reporting.
lpszOp
Points to a null-terminated string specifying the operation to perform. This parameter can be “open” or “print”. If this parameter is NULL, “open” is the default value.
lpszFile
Points to a null-terminated string specifying the file to open.
lpszParams
Points to a null-terminated string specifying parameters passed to the program when lpszFile specifies an executable file. If lpszFile specifies a document file, this parameter is NULL.
lpszDir
Points to a null-terminated string specifying the default directory.
wShowCmd
Specifies whether the program is shown when it is opened. If lpszFile specifies a document file, this parameter should be zero.
The return value is the instance handle of the program that was run if the function is successful. (This handle could also be the handle of a DDE server application.) If the return value is less than or equal to 32, it specifies an error code. The possible error values are listed in the following “Comments” section.
The file specified by the lpszFile parameter can be a document file or an executable file. If it is a document file, this function opens or prints it, depending on the value of the lpszOp parameter. If it is an executable file, this function opens it, even if lpszOp specifies PRINT.
FindExecutable