获取 GetLastError 文本信息

DWORD derr = GetLastError(); 
derr = derr;
LPVOID lpMsgBuf;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); // Process any inserts in lpMsgBuf.

// ...
// Display the string.
AfxMessageBox((LPCTSTR)lpMsgBuf);
原文地址:https://www.cnblogs.com/carl2380/p/2317353.html