crashrpt
Public Member Functions | Public Attributes | List of all members
CrAutoInstallHelper Class Reference

Installs exception handlers in constructor and uninstalls in destructor. More...

#include <CrashRpt.h>

Public Member Functions

 CrAutoInstallHelper (__in PCR_INSTALL_INFOA pInfo)
 Installs exception handlers to the caller process.
 
 CrAutoInstallHelper (__in PCR_INSTALL_INFOW pInfo)
 Installs exception handlers to the caller process.
 
 ~CrAutoInstallHelper ()
 Uninstalls exception handlers from the caller process.
 

Public Attributes

int m_nInstallStatus
 Install status.
 

Detailed Description

Installs exception handlers in constructor and uninstalls in destructor.

Remarks
Use this class to easily install/uninstall exception handlers in you main() or WinMain() function.

This wrapper class calls crInstall() in its constructor and calls crUninstall() in its destructor.

Use CrAutoInstallHelper::m_nInstallStatus member to check the return status of crInstall().

Example:

#include <CrashRpt.h>
void main()
{
memset(&info, 0, sizeof(CR_INSTALL_INFO));
info.cb = sizeof(CR_INSTALL_INFO);
info.pszAppName = _T("My App Name");
info.pszAppVersion = _T("1.2.3");
info.pszEmailSubject = "Error Report from My App v.1.2.3";
// The address to send reports by E-mail
info.pszEmailTo = _T("myname@hotmail.com");
// The URL to send reports via HTTP connection
info.pszUrl = _T("http://myappname.com/utils/crashrpt.php");
info.pfnCrashCallback = CrashCallback;
info.uPriorities[CR_HTTP] = 3; // Try HTTP first
info.uPriorities[CR_SMTP] = 2; // Try SMTP second
info.uPriorities[CR_SMAPI] = 1; // Try system email program last
// Install crash reporting
CrAutoInstallHelper cr_install_helper(&info);
// Check that installed OK
assert(cr_install_helper.m_nInstallStatus==0);
// Your code follows here ...
}

The documentation for this class was generated from the following file: