Notes on how to use crashrpt under windows

    . The reason for calling crInstall error is generally that CrashRptXXXX.dll, CrashSenderXXXX.exe and crashrpt_lang.ini are not placed in the correct path. By default, this path is the same path as the application. Where XXXX refers to the version number of crashrpt.

#include "CrashRpt.h"
#pragma comment(lib,"CrashRpt1402d.lib")

  1. // Set the parameters of crashrpt  
  2.   
  3.  CR_INSTALL_INFO info;  
  4.     memset(&info, 0, sizeof(CR_INSTALL_INFO));  
  5.     info.cb = sizeof(CR_INSTALL_INFO);             // Size of the structure  
  6.     info.pszAppName = _T("PhotoExtract"); // App name  
  7.     info.pszAppVersion = _T("1.0.0");              // App version  
  8.     info.pszEmailSubject = _T("CrashRpt Console Test 1.0.0 Error Report"); // Email subject  
  9.     info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS;    
  10.     info.dwFlags |= CR_INST_DONT_SEND_REPORT;        //Don't send mail, save it locally  
  11.     info.pszErrorReportSaveDir = TEXT("./crashRptData");  
  12.     int nInstResult = crInstall(&info);    
  13.      
  14.     if(nInstResult!=0)  
  15.     {  
  16.         TCHAR buff[256];  
  17.         crGetLastErrorMsg(buff, 256); // Get last error  
  18.         _tprintf(_T("%s\n"), buff); // and output it to the screen  
  19.         return FALSE;  
  20.     }  
  21.      //Add a screenshot when the program crashes to the error report     
  22.     crAddScreenshot(CR_AS_VIRTUAL_SCREEN);  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325450362&siteId=291194637