首页 > 代码库 > FormatMessage 错误消息

FormatMessage 错误消息

 1     // Get the error code 2     DWORD dwError = GetDlgItemInt(IDC_EDIT1); 3  4     HLOCAL hlocal = NULL;   // Buffer that gets the error message string 5  6     // Use the default system locale since we look for Windows messages. 7     // Note: this MAKELANGID combination has 0 as value 8     DWORD systemLocale = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); 9 10     // Get the error code‘s textual description11     BOOL fOk = FormatMessage(12         FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |13         FORMAT_MESSAGE_ALLOCATE_BUFFER,14         NULL, dwError, systemLocale,15         (PTSTR) &hlocal, 0, NULL);16 17     SetDlgItemText(IDC_TEXTOUT,(PTSTR) LocalLock(hlocal));

 

FormatMessage 错误消息