crashrpt2
作者:互联网
1.生成
下载源码: https://github.com/CrashRpt/crashrpt2
将下载的crashrpt2-maste.zip文件解压,使用CMake安装(编译)工具生成VS工程
打开CrashRpt.sln,编译生成dll、exe、ini文件
2.使用
新建项目,添加include和lib
软件启动时初始化
// Install crash reporting
CR_INSTALL_INFO info;
memset(&info, 0, sizeof(CR_INSTALL_INFO));
info.cb = sizeof(CR_INSTALL_INFO);
info.pszAppName = _T("CrashRptTest"); // Define application name.
info.pszAppVersion = _T("1.0.0"); // Define application version.
info.pszCrashSenderPath = _T("…");//CrashSender.exe路径
info.pszErrorReportSaveDir = _T("…");//保存错误报告的路径
info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS;//安装所有可能的异常处理程序
info.dwFlags |= CR_INST_DONT_SEND_REPORT; //不要发送邮件,保存到本地
int nResult = crInstall(&info);
if (nResult != 0)
{
TCHAR buff[256];
crGetLastErrorMsg(buff, 256);
MessageBox(NULL, buff, _T("crInstall error"), MB_OK);
return 1;
}
//截屏保存
crAddScreenshot2(CR_AS_MAIN_WINDOW | CR_AS_USE_JPEG_FORMAT, 95);
软件关闭时卸载
crUninstall();
生成的错误报告:
生成的.dmp文件使用VS打开
标签:info,INFO,crashrpt2,INSTALL,CR,buff 来源: https://www.cnblogs.com/hyy123/p/16543434.html