Contents Index Topic Contents | ||
Previous Topic: ShellExecute Next Topic: SHFileOperation |
ShellExecuteEx
WINSHELLAPI BOOL WINAPI ShellExecuteEx( LPSHELLEXECUTEINFO lpExecInfo );Performs an action on a file.
- Returns a nonzero value if successful, or zero otherwise. To get extended error information, call the GetLastError function.
- lpExecInfo
- Address of a SHELLEXECUTEINFO structure that contains and receives information about the application being executed.
If the function succeeds, it sets the hInstApp member of the SHELLEXECUTEINFO structure to the instance handle to the application that the function started. If the function fails, hInstApp is one of the SE_ERR_ error values indicating the cause of the failure. (An instance handle will always be greater than 32 and an error value less than 32.) Note that the SE_ERR_ error values are for compatibility with the ShellExecute function; use the GetLastError function to retrieve error information.
The error value returned by GetLastError corresponds to the SE_ERR_ values and may be one of the following:
ERROR_FILE_NOT_FOUND The specified file was not found. ERROR_PATH_NOT_FOUND The specified path was not found. ERROR_DDE_FAIL The DDE transaction failed. ERROR_NO_ASSOCIATION There is no application associated with the given file name extension. ERROR_ACCESS_DENIED Access to the specified file is denied. ERROR_DLL_NOT_FOUND One of the library files necessary to run the application can't be found. ERROR_CANCELLED The function prompted the user for the location of the application, but the user canceled the request. ERROR_NOT_ENOUGH_MEMORY There is not enough memory to perform the specified action. ERROR_SHARING_VIOLATION A sharing violation occurred.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.