hellomotor / crashrpt

Automatically exported from code.google.com/p/crashrpt
0 stars 0 forks source link

Limit the CrashSender UI. Don't allow closing the CrashSender without sending out the report. #126

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using the CrashRpt internally in an organization, we want to make sending 
the error report mandatory. 

Make the CrashRpt configurable to disable "Close Window" button and "Close" or 
"Cancel" buttons.

Original issue reported on code.google.com by bubn...@gmail.com on 3 Jan 2012 at 12:06

GoogleCodeExporter commented 9 years ago
If you want to make crash reporting mandatory, than why don't you use silent 
(non-GUI) mode? I think it would solve your problem. The purpose of the 
OK/Cancel buttons is to give user an ability to provide his consent or not 
provide his consent, so disabling the Cancel button would break this idea.

Original comment by zexspect...@gmail.com on 5 Jan 2012 at 8:31

GoogleCodeExporter commented 9 years ago
I need to inform the operator, that a crash happened and he needs to finish his 
work if possible and restart the application. Such a message can be displayed 
by the application itself, or by the CrashSender. I opted for the second 
solution.

I would also like to keep the user updated about the sending process, so if the 
crash sender hangs for any reason, it will be obvious and not hidden. Maybe in 
the future we may switch to the silent mode, but now when introducing it I feel 
uneasy about the silent mode.

Anyway, it was easy enough to add a flag CR_INST_SENDER_SEND_ALWAYS to dwFlags 
and to trickle it down to CrashInfoReader. I extended following methods then:

LRESULT CErrorReportDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM 
/*lParam*/, BOOL& /*bHandled*/)

    if (g_CrashInfo.m_bSendAlways) {
        m_btnCancel.ShowWindow(SW_HIDE);
        SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) & ~WS_SYSMENU);
    } else {
        if(g_CrashInfo.m_bQueueEnabled)
m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, 
_T("MainDlg"), _T("OtherActions"), g_CrashInfo.m_nTextGroupID));
        else
            m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("CloseTheProgram"), g_CrashInfo.m_nTextGroupID));
    }

and to be sure, I added following snippet to the beginning of
LRESULT CErrorReportDlg::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM 
/*lParam*/, BOOL& /*bHandled*/)
and
void CErrorReportDlg::CloseDialog(int nVal)

    if (g_CrashInfo.m_bSendAlways)
        return;

That is the beauty of CrashRpt, that I can tailor it easily for my particular 
needs. Thanks a lot for the library, it saves me a lot of effort and makes our 
application better.

Vojtech

Original comment by bubn...@gmail.com on 5 Jan 2012 at 8:52

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1340.

Original comment by zexspect...@gmail.com on 25 Aug 2012 at 8:20