jirentabu / crashrpt

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

About Restart CheckBox Visible #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
version: 1.2.6_r804

I found that the Restart CheckBox Allways Hidden in 90% chance!

My Code is(Always):

    CR_INSTALL_INFO info;
    memset(&info, 0, sizeof(CR_INSTALL_INFO));
    info.cb = sizeof(CR_INSTALL_INFO);

    ......

    info.dwFlags = 0;                    
    info.dwFlags |= CR_INST_ALL_EXCEPTION_HANDLERS; // Install all available exception handlers.
    info.dwFlags |= CR_INST_HTTP_BINARY_ENCODING;   // Use binary encoding for HTTP uploads (recommended).  
    info.dwFlags |= CR_INST_APP_RESTART;            // Restart the application on crash.

    ......

but the Restart CheckBox always hidden most of times.

/*******************************************************************
*
*  Some refer function of crashrpt library
*
*******************************************************************/

@refer function 1
LRESULT CErrorReportDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM 
/*lParam*/, BOOL& /*bHandled*/)
{
    ......

    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);

    ......
}

@refer function 2
LRESULT CErrorReportDlg::OnRestartClick(WORD /*wNotifyCode*/, WORD /*wID*/, 
HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
  BOOL bRestart = m_chkRestart.GetCheck() == BST_CHECKED ? TRUE : FALSE;
  g_CrashInfo.m_bAppRestart = bRestart;

  return 0;
}

@refer function 3
// This method restarts the application
BOOL CErrorReportSender::RestartApp()
{
    if(g_CrashInfo.m_bAppRestart==FALSE)
        return FALSE;

    ......
}

@refer function 4
int CCrashInfoReader::Init(CString sCrashInfoFileName)
{
    ......

    m_bAppRestart = FALSE;    
    TiXmlHandle hAppRestart = hRoot.FirstChild("AppRestart");
    if(hAppRestart.FirstChild().ToText()!=NULL)
    {
        const char* szAppRestart = hAppRestart.FirstChild().ToText()->Value();
        if(szAppRestart!=NULL)
            m_bAppRestart = atoi(szAppRestart);     
    } 

    ......
}

==============================================================
Set CR_INST_APP_RESTART => m_bAppRestart = true? => 
m_chkRestart.ShowWindow(SW_SHOW)?

    m_chkRestart.SetCheck(BST_CHECKED);
    m_chkRestart.ShowWindow(g_CrashInfo.m_bAppRestart ? SW_SHOW : SW_HIDE);

the Restart CheckBox is checked(Default Status) in UI, but 
g_CrashInfo.m_bAppRestart Maybe is false!

I always set
    info.dwFlags |= CR_INST_APP_RESTART;            // Restart the application on crash.

But I always found the CheckBox is hidden.
So (info.dwFlags |= CR_INST_APP_RESTART) != (g_CrashInfo.m_bAppRestart = true)?

Original issue reported on code.google.com by dreamexcel@gmail.com on 16 Sep 2010 at 9:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I Found this:

File: ./de78de8e-b846-4d53-a1a6-4df45840ecec.xml
Content:
<?xml version="1.0" encoding="UTF-8" ?>
<CrashRptInternal version="1206">
  ......
  <AppRestart>1</AppRestart>
  <RestartCmdLine>/restart</RestartCmdLine>
  ......
</CrashRptInternal>

File: ./de78de8e-b846-4d53-a1a6-4df45840ecec/~CrashRptInternal.xml
Content: 
<?xml version="1.0" encoding="UTF-8" ?>
<CrashRptInternal version="1206">
  ......
  <AppRestart>0</AppRestart>
  <RestartCmdLine>/restart</RestartCmdLine>
  ......
</CrashRptInternal>

Original comment by dreamexcel@gmail.com on 16 Sep 2010 at 9:45

GoogleCodeExporter commented 9 years ago
Tre restart checkbox is shown if at least 60 seconds elapsed since the start of 
the application. For more info, please read documentation of crInstall() 
function. 

Original comment by zexspect...@gmail.com on 17 Sep 2010 at 8:06

GoogleCodeExporter commented 9 years ago
Thank you for reminding me, I acctually did not read the document yet, so lazy 
i am, huh, huh.
Happy Mid-Autumn Festival!

Also you are the first foreigner and relay my message, ha ha.
Of course your destination is trying to change CrashRpt better and better,
But I still very happy, with my poor English(Chinese English)

I am a newbie

中国人看到别打击我哦!小生怕怕!

Original comment by dreamexcel@gmail.com on 19 Sep 2010 at 3:24

GoogleCodeExporter commented 9 years ago
Nothing to fix here.

Original comment by zexspect...@gmail.com on 25 Sep 2010 at 2:47