Format the error value returned by ShellExecute

Source: Internet
Author: User

DWORD excutecmd (hwnd hparent, maid, maid) <br/>{< br/> dword hret = (DWORD) ShellExecute (hparent, <br/> szoperate, lpszpathfolderfile, lpszparam, lpszdir, ncmd ); <br/> If (HRET> 32) <br/>{< br/>}< br/> else <br/>{< br/> cstring szmsg = _ T (""); <br/> # define case_err (x, y) Case (x): szmsg = _ T (Y); break; <br/> switch (HRET) <br/> {<br/> case_err (0, "the operating system is out of memory or resources. ") <br/> case_err (error_bad_format,". EXE file is invalid (non-Win32?. EXE or error in. EXE image ). ") <br/> case_err (se_err_accessdenied," the operating system denied access to the specified file. ") <br/> case_err (se_err_associncomplete," the file name association is incomplete or invalid. ") <br/> case_err (se_err_ddebusy," the DDE transaction cocould not be completed because other DDE transactions were being processed. ") <br/> case_err (se_err_ddefail," the DDE transaction failed. ") <br/> case_err (se_err_ddetimeout," the DDE transaction cocould not be completed because the request timed out. ") <br/> case_err (se_err_dllnotfound," the specified dynamic-Link Library was not found. ") <br/> case_err (se_err_fnf," the specified file was not found. ") <br/> case_err (se_err_noassoc," there is no application associated with the given file name extension. ") <br/> case_err (se_err_oom," there was not enough memory to complete the operation. ") <br/> case_err (se_err_pnf," the specified path was not found. ") <br/> case_err (se_err_share," a sharing violation occurred. ") <br/> default: szmsg. format (_ T ("unknow error % lD"), HRET); <br/>}< br/> afxmessagebox (szmsg ); <br/>}</P> <p> return HRET; <br/>}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.