. 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")
- // Set the parameters of crashrpt
- CR_INSTALL_INFO info;
- memset(&info, 0, sizeof(CR_INSTALL_INFO));
- info.cb = sizeof(CR_INSTALL_INFO); // Size of the structure
- info.pszAppName = _T("PhotoExtract"); // App name
- info.pszAppVersion = _T("1.0.0"); // App version
- info.pszEmailSubject = _T("CrashRpt Console Test 1.0.0 Error Report"); // Email subject
- info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS;
- info.dwFlags |= CR_INST_DONT_SEND_REPORT; //Don't send mail, save it locally
- info.pszErrorReportSaveDir = TEXT("./crashRptData");
- int nInstResult = crInstall(&info);
- if(nInstResult!=0)
- {
- TCHAR buff[256];
- crGetLastErrorMsg(buff, 256); // Get last error
- _tprintf(_T("%s\n"), buff); // and output it to the screen
- return FALSE;
- }
- //Add a screenshot when the program crashes to the error report
- crAddScreenshot(CR_AS_VIRTUAL_SCREEN);