FormatMessage removes error text through error code

xiaoxiao2021-03-06  98

// Get the error code dword dwerror = getdlgitemint (hwnd, idc_errorcode, null, false);

Handle Hlocal = NULL; // Buffer That Gets The Error Message String

// Get the error code's textual description BOOL fOk = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, dwError, MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), (PTSTR) & hlocal, 0, NULL);

IF (! fok) {// is it a network-related error? hmodule hdll = loadingLibraryEx (Text ("Netmsg.dll"), NULL, DONT_RESOLVE_DLL_REFERENCES;

(! HDll = NULL) if {FormatMessage (FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_FROM_SYSTEM, hDll, dwError, MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), (PTSTR) & hlocal, 0, NULL); FreeLibrary (hDll);}}

if (hlocal = NULL!) {SetDlgItemText (hwnd, IDC_ERRORTEXT, (PCTSTR) LocalLock (hlocal)); LocalFree (hlocal);} else {SetDlgItemText (hwnd, IDC_ERRORTEXT, TEXT ( "Error number not found."));} Break;

转载请注明原文地址:https://www.9cbs.com/read-100552.html

New Post(0)