文件名称:获取Windows出错描述
文件大小:1KB
文件格式:TXT
更新时间:2012-04-05 04:28:39
Windows 获取Windows出错描述
char* GetWinErrorDesc( int nErrorCode ) { static char sMsg[1024] = ""; LPVOID lpMsgBuf = 0; if (::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, 0, nErrorCode, LANG_USER_DEFAULT, (LPTSTR) &lpMsgBuf, 0, 0)) { strcpy( sMsg, (char*)lpMsgBuf ); ::LocalFree(lpMsgBuf); return sMsg; } return NULL; }