Shellexecute Return Value Error Messages

I get the return value when I call ShellExecute - an integer. Where can I get related error messages? I know that they are common, but I saw the messages in the MS documentation.

+4
source share
1 answer

Error handling for ShellExecute is a bit of a disaster. Raymond Chen discusses it here: Why does ShellExecute return SE_ERR_ACCESSDENIED for almost everything? So, even if you can convert several possible ShellExecute errors to text, you will always get Access denied . And it is not very useful.

The bottom line is that if you need real error reporting, you need to use ShellExecuteEx . If this fails, you call GetLastError to get a Win32 error. To turn it into a descriptive text exception, RaiseLastOSError . If you just need the descriptive text associated with the error, you call SysErrorMessage .

+7
source

All Articles