由 错误号 得到 错误字符串
来源:互联网 发布:深圳易佰网络怎么样 编辑:程序博客网 时间:2024/05/21 08:41
FormatMessageA(//FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,NULL,GetLastError(),0,//Default language lpErrMsgBuf,100,NULL); printf("Fail Starting the Service. Error %ld: %s",GetLastError(),lpErrMsgBuf);LocalFree(lpErrMsgBuf);
更可以编成宏:
#define PRINT_ERR(x, err) {\char lpErrMsgBuf_75367[101]={0};\int errNum_25456 = err;\FormatMessageA(\FORMAT_MESSAGE_FROM_SYSTEM|\FORMAT_MESSAGE_IGNORE_INSERTS,\NULL,\errNum_25456,\0,/*Default language*/\lpErrMsgBuf_75367,\100,\NULL);\printf(x, errNum_25456, lpErrMsgBuf_75367);}
调用时使用 PRINT_ERR("xxxxxxxx failed! Error %d : %s\n", GetLastError());
现在发现,为何不用CException类呢
TRY{DoDataExchange(&dx);bOK = TRUE; // it worked}CATCH(CUserException, e){// validation failed - user already alerted, fall throughASSERT(!bOK);// Note: DELETE_EXCEPTION_(e) not required}AND_CATCH_ALL(e){// validation failed due to OOM or other resource failuree->ReportError(MB_ICONEXCLAMATION, AFX_IDP_INTERNAL_FAILURE);ASSERT(!bOK);DELETE_EXCEPTION(e);}END_CATCH_ALL
- 由 错误号 得到 错误字符串
- 使用FormatMessage获取由GetLastError得到的错误的描述
- 由AppendMenu()引发的错误
- 由莫名其妙的错误开始
- 由3a("aaa")字符串得到1000字符串
- 由GetLastError()获得的错误代码得到字符串描述
- 由GetLastError()获得的错误代码得到字符串描述
- 判断字符串s2能否由s1旋转得到
- 错误的字符串比较
- 字符串拷贝的错误
- StringIndexOutOfBoundsException 字符串越界错误
- error:字符串错误
- 字符串读取错误
- js 字符串 错误
- 字符串常量&段错误
- 字符串处理错误记录
- java字符串错误
- 字符串截取的错误
- Intent的uri
- 伟大的HfutEngine
- 使用HTML5实现多文件上传
- 第二章 7 HTML5 表单属性
- C指针,C语言中的指针详解
- 由 错误号 得到 错误字符串
- C# events vs. delegates
- Custom BAPI for FB50 or FB50L for Parking FI document.
- 二:数据库基本概念类
- Service
- 购物网第一阶段总结笔记5:后台登陆模块(ASP.NET内置票据认证的使用)
- 浅谈PPM (Project Portfolio Management) - 6
- oracle启用和禁用约束条件等
- Broadcast Receiver