LRESULT CErrorReportDlg::OnMoreInfoClick(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { // Expand dialog m_linkMoreInfo.EnableWindow(0); ShowMoreInfo(TRUE); return 0; }
LRESULT CErrorReportDlg::OnMoreInfoClick(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { // This method is called when user clicks the // "Provide additional info (recommended)" link. // Expand dialog m_linkMoreInfo.EnableWindow(0); ShowMoreInfo(TRUE); return 0; }
LRESULT CErrorReportDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // Mirror this window if RTL language is in use CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { Utility::SetLayoutRTL(m_hWnd); } SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("DlgCaption"))); // Center the dialog on the screen CenterWindow(); HICON hIcon = NULL; // Get custom icon hIcon = g_CrashInfo.GetCustomIcon(); if(hIcon==NULL) { // Use default icon hIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)); } // Set window icon SetIcon(hIcon, 0); // Get the first icon in the EXE image m_HeadingIcon = ExtractIcon(NULL, g_CrashInfo.GetReport(0).m_sImageName, 0); // If there is no icon in crashed EXE module, use IDI_APPLICATION system icon if(m_HeadingIcon == NULL) { m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); } m_statSubHeader = GetDlgItem(IDC_SUBHEADER); m_link.SubclassWindow(GetDlgItem(IDC_LINK)); m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_link.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("WhatDoesReportContain"))); m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO)); m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_linkMoreInfo.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("ProvideAdditionalInfo"))); m_statEmail = GetDlgItem(IDC_STATMAIL); m_statEmail.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("YourEmail"))); m_editEmail = GetDlgItem(IDC_EMAIL); m_statDesc = GetDlgItem(IDC_DESCRIBE); m_statDesc.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("DescribeProblem"))); m_editDesc = GetDlgItem(IDC_DESCRIPTION); m_statIndent = GetDlgItem(IDC_INDENT); m_chkRestart = GetDlgItem(IDC_RESTART); CString sCaption; sCaption.Format(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("RestartApp")), g_CrashInfo.m_sAppName); m_chkRestart.SetWindowText(sCaption); m_chkRestart.SetCheck(BST_CHECKED); m_chkRestart.ShowWindow(g_CrashInfo.m_bAppRestart?SW_SHOW:SW_HIDE); m_statConsent = GetDlgItem(IDC_CONSENT); // Init font for consent string LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 11; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); CFontHandle hConsentFont; hConsentFont.CreateFontIndirect(&lf); m_statConsent.SetFont(hConsentFont); if(g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty()) m_statConsent.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("MyConsent2"))); else m_statConsent.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("MyConsent"))); m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY)); m_linkPrivacyPolicy.SetHyperLink(g_CrashInfo.m_sPrivacyPolicyURL); m_linkPrivacyPolicy.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("PrivacyPolicy"))); BOOL bShowPrivacyPolicy = !g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty(); m_linkPrivacyPolicy.ShowWindow(bShowPrivacyPolicy?SW_SHOW:SW_HIDE); m_statCrashRpt = GetDlgItem(IDC_CRASHRPT); m_statHorzLine = GetDlgItem(IDC_HORZLINE); m_btnOk = GetDlgItem(IDOK); m_btnOk.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("SendReport"))); m_btnCancel = GetDlgItem(IDC_CANCEL); if(g_CrashInfo.m_bQueueEnabled) m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("OtherActions"))); else m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("CloseTheProgram"))); // Init font for heading text memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 25; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); m_HeadingFont.CreateFontIndirect(&lf); m_Layout.SetContainerWnd(m_hWnd); m_Layout.Insert(m_linkMoreInfo); m_Layout.Insert(m_statIndent); m_Layout.Insert(m_statEmail, TRUE); m_Layout.Insert(m_editEmail, TRUE); m_Layout.Insert(m_statDesc, TRUE); m_Layout.Insert(m_editDesc, TRUE); m_Layout.Insert(m_chkRestart); m_Layout.Insert(m_statConsent); m_Layout.Insert(m_linkPrivacyPolicy); m_Layout.Insert(m_statCrashRpt); m_Layout.Insert(m_statHorzLine, TRUE); m_Layout.Insert(m_btnOk); m_Layout.Insert(m_btnCancel, TRUE); ShowMoreInfo(FALSE); m_dlgProgress.Create(m_hWnd); m_dlgProgress.Start(TRUE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); if(pLoop) { pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); } UIAddChildWindowContainer(m_hWnd); return TRUE; }
LRESULT CMainDlg::OnMoreInfoClick(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { m_linkMoreInfo.EnableWindow(0); ShowMoreInfo(TRUE); return 0; }
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CString sRTL = Utility::GetINIString(_T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { Utility::SetLayoutRTL(m_hWnd); } SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("DlgCaption"))); // center the dialog on the screen CenterWindow(); // Set window icon SetIcon(::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)), 0); // Load heading icon HMODULE hExeModule = LoadLibrary(g_CrashInfo.m_sImageName); if(hExeModule) { // Use IDR_MAINFRAME icon which is the default one for the crashed application. m_HeadingIcon = ::LoadIcon(hExeModule, MAKEINTRESOURCE(IDR_MAINFRAME)); } // If there is no IDR_MAINFRAME icon in crashed EXE module, use IDI_APPLICATION system icon if(m_HeadingIcon == NULL) { m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); } CStatic statSubHeader = GetDlgItem(IDC_SUBHEADER); statSubHeader.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("SubHeaderText"))); m_link.SubclassWindow(GetDlgItem(IDC_LINK)); m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_link.SetLabel(Utility::GetINIString(_T("MainDlg"), _T("WhatDoesReportContain"))); m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO)); m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_linkMoreInfo.SetLabel(Utility::GetINIString(_T("MainDlg"), _T("ProvideAdditionalInfo"))); m_statEmail = GetDlgItem(IDC_STATMAIL); m_statEmail.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("YourEmail"))); m_editEmail = GetDlgItem(IDC_EMAIL); m_statDesc = GetDlgItem(IDC_DESCRIBE); m_statDesc.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("DescribeProblem"))); m_editDesc = GetDlgItem(IDC_DESCRIPTION); m_statIndent = GetDlgItem(IDC_INDENT); m_statConsent = GetDlgItem(IDC_CONSENT); LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 11; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); CFontHandle hConsentFont; hConsentFont.CreateFontIndirect(&lf); m_statConsent.SetFont(hConsentFont); if(g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty()) m_statConsent.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("MyConsent2"))); else m_statConsent.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("MyConsent"))); m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY)); m_linkPrivacyPolicy.SetHyperLink(g_CrashInfo.m_sPrivacyPolicyURL); m_linkPrivacyPolicy.SetLabel(Utility::GetINIString(_T("MainDlg"), _T("PrivacyPolicy"))); BOOL bShowPrivacyPolicy = !g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty(); m_linkPrivacyPolicy.ShowWindow(bShowPrivacyPolicy?SW_SHOW:SW_HIDE); m_statCrashRpt = GetDlgItem(IDC_CRASHRPT); m_statHorzLine = GetDlgItem(IDC_HORZLINE); m_btnOk = GetDlgItem(IDOK); m_btnOk.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("SendReport"))); m_btnCancel = GetDlgItem(IDCANCEL); m_btnCancel.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("CloseTheProgram"))); CRect rc1, rc2, rc3, rc4; m_editEmail.GetWindowRect(&rc1); m_statConsent.GetWindowRect(&rc2); m_nDeltaY = rc2.top-rc1.top; m_linkPrivacyPolicy.GetWindowRect(&rc3); m_statCrashRpt.GetWindowRect(&rc4); m_nDeltaY2 = rc4.top-rc3.top; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 25; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); m_HeadingFont.CreateFontIndirect(&lf); ShowMoreInfo(FALSE); m_dlgProgress.Create(m_hWnd); m_dlgProgress.Start(TRUE); DWORD dwThreadId = 0; m_hSenderThread = CreateThread(NULL, 0, CollectorThread, (LPVOID)&m_ctx, 0, &dwThreadId); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); return TRUE; }
LRESULT CErrorReportDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CErrorReportSender* pSender = CErrorReportSender::GetInstance(); CCrashInfoReader* pCrashInfo = pSender->GetCrashInfo(); // Mirror this window if RTL language is in use. CString sRTL = pSender->GetLangStr(_T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { Utility::SetLayoutRTL(m_hWnd); } // Set dialog caption. SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("DlgCaption"))); // Center the dialog on the screen. CenterWindow(); HICON hIcon = NULL; // Get custom icon. hIcon = pCrashInfo->GetCustomIcon(); if(hIcon==NULL) { // Use default icon, if custom icon is not provided. hIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)); } // Set window icon. SetIcon(hIcon, 0); // Get the first icon in the EXE image and use it for header. m_HeadingIcon = ExtractIcon(NULL, pCrashInfo->GetReport(0)->GetImageName(), 0); // If there is no icon in crashed EXE module, use default IDI_APPLICATION system icon. if(m_HeadingIcon == NULL) { m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); } // Init controls. m_statSubHeader = GetDlgItem(IDC_SUBHEADER); m_link.SubclassWindow(GetDlgItem(IDC_LINK)); m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_link.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("WhatDoesReportContain"))); m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO)); m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_linkMoreInfo.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("ProvideAdditionalInfo"))); m_statEmail = GetDlgItem(IDC_STATMAIL); m_statEmail.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("YourEmail"))); m_editEmail = GetDlgItem(IDC_EMAIL); m_editEmail.SetWindowText(pSender->GetCrashInfo()->GetPersistentUserEmail()); m_statDesc = GetDlgItem(IDC_DESCRIBE); m_statDesc.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("DescribeProblem"))); m_editDesc = GetDlgItem(IDC_DESCRIPTION); m_statIndent = GetDlgItem(IDC_INDENT); m_chkRestart = GetDlgItem(IDC_RESTART); CString sCaption; sCaption.Format(pSender->GetLangStr(_T("MainDlg"), _T("RestartApp")), pSender->GetCrashInfo()->m_sAppName); m_chkRestart.SetWindowText(sCaption); m_chkRestart.SetCheck(BST_CHECKED); m_chkRestart.ShowWindow(pSender->GetCrashInfo()->m_bAppRestart?SW_SHOW:SW_HIDE); m_statConsent = GetDlgItem(IDC_CONSENT); // Init font for consent string. LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 11; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); CFontHandle hConsentFont; hConsentFont.CreateFontIndirect(&lf); m_statConsent.SetFont(hConsentFont); // Set text of the static if(pSender->GetCrashInfo()->m_sPrivacyPolicyURL.IsEmpty()) m_statConsent.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("MyConsent2"))); else m_statConsent.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("MyConsent"))); // Init Privacy Policy link m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY)); m_linkPrivacyPolicy.SetHyperLink(pSender->GetCrashInfo()->m_sPrivacyPolicyURL); m_linkPrivacyPolicy.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("PrivacyPolicy"))); BOOL bShowPrivacyPolicy = !pSender->GetCrashInfo()->m_sPrivacyPolicyURL.IsEmpty(); m_linkPrivacyPolicy.ShowWindow(bShowPrivacyPolicy?SW_SHOW:SW_HIDE); m_statCrashRpt = GetDlgItem(IDC_CRASHRPT); m_statHorzLine = GetDlgItem(IDC_HORZLINE); // Init OK button m_btnOk = GetDlgItem(IDOK); m_btnOk.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("SendReport"))); // Init Cancel button m_btnCancel = GetDlgItem(IDC_CANCEL); if(pSender->GetCrashInfo()->m_bQueueEnabled) m_btnCancel.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("OtherActions"))); else m_btnCancel.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("CloseTheProgram"))); // If send procedure is mandatory... if(pSender->GetCrashInfo()->m_bSendMandatory) { // Hide Cancel button m_btnCancel.ShowWindow(SW_HIDE); // Remove Close button SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) & ~WS_SYSMENU); } // Init font for heading text memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 25; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); m_HeadingFont.CreateFontIndirect(&lf); // Init control positions m_Layout.SetContainerWnd(m_hWnd); m_Layout.Insert(m_linkMoreInfo); m_Layout.Insert(m_statIndent); m_Layout.Insert(m_statEmail, TRUE); m_Layout.Insert(m_editEmail, TRUE); m_Layout.Insert(m_statDesc, TRUE); m_Layout.Insert(m_editDesc, TRUE); m_Layout.Insert(m_chkRestart); m_Layout.Insert(m_statConsent); m_Layout.Insert(m_linkPrivacyPolicy); m_Layout.Insert(m_statCrashRpt); m_Layout.Insert(m_statHorzLine, TRUE); m_Layout.Insert(m_btnOk); m_Layout.Insert(m_btnCancel, TRUE); // By default, hide the email & description fields. // But user may override the default. ShowMoreInfo(pSender->GetCrashInfo()->m_bShowAdditionalInfoFields); // Create progress dialog m_dlgProgress.Create(m_hWnd); m_dlgProgress.Start(TRUE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); if(pLoop) { pLoop->AddMessageFilter(this); } UIAddChildWindowContainer(m_hWnd); return TRUE; }
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // center the dialog on the screen CenterWindow(); // Set window icon SetIcon(::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)), 0); // Load heading icon HMODULE hExeModule = LoadLibrary(m_sImageName); if(hExeModule) { // Use IDR_MAINFRAME icon which is the default one for the crashed application. m_HeadingIcon = ::LoadIcon(hExeModule, MAKEINTRESOURCE(IDR_MAINFRAME)); } // If there is no IDR_MAINFRAME icon in crashed EXE module, use IDI_APPLICATION system icon if(m_HeadingIcon == NULL) { m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); } m_link.SubclassWindow(GetDlgItem(IDC_LINK)); m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO)); m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON); m_statEmail = GetDlgItem(IDC_STATMAIL); m_editEmail = GetDlgItem(IDC_EMAIL); m_statDesc = GetDlgItem(IDC_DESCRIBE); m_editDesc = GetDlgItem(IDC_DESCRIPTION); m_statCrashRpt = GetDlgItem(IDC_CRASHRPT); m_statHorzLine = GetDlgItem(IDC_HORZLINE); m_btnOk = GetDlgItem(IDOK); m_btnCancel = GetDlgItem(IDCANCEL); CRect rc1, rc2; m_linkMoreInfo.GetWindowRect(&rc1); m_statHorzLine.GetWindowRect(&rc2); m_nDeltaY = rc1.bottom+15-rc2.top; LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 25; lf.lfWeight = FW_NORMAL; lf.lfQuality = ANTIALIASED_QUALITY; _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma")); m_HeadingFont.CreateFontIndirect(&lf); ShowMoreInfo(FALSE); m_dlgProgress.Create(m_hWnd); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); return TRUE; }