Clone
ixen <ixen@copyhandler.com>
committed
on 23 Feb 08
Added basic crash support to CH (advances [#425]).
LoggerImprovements + 5 more
src/ch/CrashDlg.cpp (+71)
  1 // CrashDlg.cpp : implementation file
  2 //
  3
  4 #include "stdafx.h"
  5 #include "ch.h"
  6 #include "CrashDlg.h"
  7 #include "version.h"
  8
  9 #define IDS_CRASH_TITLE                 _T("Application crashed")
  10 #define IDS_STATIC_INFO                 _T("Copy Handler encountered an internal problem and will be closed.\n\nIf you want to help correct this problem in the future releases of program you can send the crash information to the author of this program.")
  11 #define IDS_VERSIONINFO_STATIC  _T("Program version:")
  12 #define IDS_LOCATIONINFO_STATIC _T("Crash dump location:")
  13 #define IDS_LOCATION_STATIC             _T("Error encountered while trying to create crash dump")
  14 #define IDS_OK                                  _T("&Send the crash information")
  15 #define IDS_CANCEL                              _T("&Do not send")
  16
  17 // CCrashDlg dialog
  18
  19 IMPLEMENT_DYNAMIC(CCrashDlg, CHLanguageDialog)
  20
  21 CCrashDlg::CCrashDlg(bool bResult, PCTSTR pszFilename, CWnd* pParent /*=NULL*/)
  22         : CDialog(CCrashDlg::IDD, pParent),
  23         m_bResult(bResult),
  24         m_strFilename(pszFilename)
  25 {
  26 }
  27
  28 CCrashDlg::~CCrashDlg()
  29 {
  30 }
  31
  32 void CCrashDlg::DoDataExchange(CDataExchange* pDX)
  33 {
  34         CDialog::DoDataExchange(pDX);
  35         DDX_Control(pDX, IDC_VERSION_STATIC, m_ctlVersion);
  36         DDX_Control(pDX, IDC_LOCATION_EDIT, m_ctlLocation);
  37         DDX_Control(pDX, IDOK, m_ctlOKButton);
  38         DDX_Control(pDX, IDC_STATIC_INFO, m_ctlInfo);
  39         DDX_Control(pDX, IDC_VERSIONINFO_STATIC, m_ctlVersionInfo);
  40         DDX_Control(pDX, IDC_LOCATIONINFO_STATIC, m_ctlLocationInfo);
  41         DDX_Control(pDX, IDCANCEL, m_ctlCancelButton);
  42 }
  43
  44
  45 BEGIN_MESSAGE_MAP(CCrashDlg, CDialog)
  46 END_MESSAGE_MAP()
  47
  48
  49 // CCrashDlg message handlers
  50
  51 BOOL CCrashDlg::OnInitDialog()
  52 {
  53         CDialog::OnInitDialog();
  54
  55         SetWindowText(IDS_CRASH_TITLE);
  56         m_ctlInfo.SetWindowText(IDS_STATIC_INFO);
  57         m_ctlVersionInfo.SetWindowText(IDS_VERSIONINFO_STATIC);
  58         m_ctlVersion.SetWindowText(PRODUCT_FULL_VERSION);
  59         m_ctlLocationInfo.SetWindowText(IDS_LOCATIONINFO_STATIC);
  60         if(m_bResult)
  61                 m_ctlLocation.SetWindowText(m_strFilename);
  62         else
  63                 m_ctlLocation.SetWindowText(IDS_LOCATION_STATIC);
  64
  65         m_ctlOKButton.SetWindowText(IDS_OK);
  66         m_ctlCancelButton.SetWindowText(IDS_CANCEL);
  67         m_ctlOKButton.EnableWindow(m_bResult);
  68
  69         return TRUE// return TRUE unless you set the focus to a control
  70         // EXCEPTION: OCX Property Pages should return FALSE
  71 }