printError

来源:互联网 发布:比思论坛最新域名 编辑:程序博客网 时间:2024/04/28 00:28
void printError( TCHAR* msg ){DWORD eNum;TCHAR sysMsg[256];TCHAR* p;eNum = GetLastError( );FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,NULL, eNum,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),sysMsg, 256, NULL );// Trim the end of the line and terminate it with a nullp = sysMsg;while( ( *p > 31 ) || ( *p == 9 ) )++p;do { *p-- = 0; } while( ( p >= sysMsg ) &&( ( *p == '.' ) || ( *p < 33 ) ) );// Display the message_tprintf( TEXT("\n\t%s failed with error %d (%s)"),msg, eNum, sysMsg );}

0 0
原创粉丝点击