示例代码如下:
CallWin32API();
DWORD nErrorNo = GetLastError();
LPSTR lpBuffer;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
nErrorNo,
LANG_NEUTRAL,
(LPTSTR)&lpBuffer,
0,
NULL);
CString strErrorCause = lpBuffer ? (wchar_t *)lpBuffer:_T("Sorry, cannot find this error info.");
::AfxMessageBox(strErrorCause);
阅读(928) | 评论(0) | 转发(0) |