首页 > 其他 > 详细

showErrorInfo

时间:2015-03-23 23:14:56      阅读:253      评论:0      收藏:0      [点我收藏+]
void showErrorInfo(UINT nErrCode, UINT nLine, LPCTSTR lpFuncName, UINT nType);

/**************************************************************** 
// FunctionName    :    showErrorInfo
// Function        :    显示错误信息
// Parameter       :   nErrCode    :错误码
                       nLine      :__LINE__    
                       lpFuncName     :函数名称
                       nType          :该参数控制错误信息显示方式

// Author      :    Lthis
// Create          :    2015-3-23 21:09:34 
// Checked         :    Lthis 2015-3-23 
****************************************************************/

void CLoadNtDriver::showErrorInfo(UINT nErrCode, UINT nLine, LPCTSTR lpFuncName, UINT nType){
    LPTSTR lpMsgBuf = NULL;
    TCHAR szMessage[256] = { 0 };
    TCHAR szCaption[32]  = { 0 };

    FormatMessage(0x1300, NULL, nErrCode, 0x400, (LPTSTR)&lpMsgBuf, 64, NULL);
    StringCchPrintf(szMessage, 256, _T("Error code:0x%X:%s\n"), nErrCode, lpMsgBuf);
    StringCchPrintf(szCaption, 32, _T("%s (Error Line:%d)"), lpFuncName, nLine);
    StringCchCat(szMessage, 256+32+1, szCaption);

    switch (nType)
    {
    case 0:
        OutputDebugString(szMessage);
        break;
    case 1:
        MessageBox(NULL, szMessage, szCaption, 0);
        break;
    default:
        break;
    }
}

......

showErrorInfo

原文:http://www.cnblogs.com/Lthis/p/4361037.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!