jirentabu / crashrpt

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

Issue with simple MFC application... #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,
 I have a simple MFC application. There are two files CCRTesterView.cpp and CCRTesterApp.cpp.
I have registered crash handlers in InitInstance() of CCRTesterApp. If I crash 
it in the same function it is caught and report is generated.
But if I crash it in OnFilePrintPreview() of CCRTesterView it doesn't catch the 
exception.
Can you please tell me if this is a problem or I am missing something.

I am attaching my sample project with this.
Please change the linker and c++ path in properties with yours.
You can notice that if u make it crash in the same class where it was 
registered, it is caught. But if you do the same thing from different class, 
it's not handled.

What version of CrashRpt are you using?
I am using latest version().

What is your version of Visual Studio?
VC 2010

What is your version of Windows operating system?
Windows Vista Business. SP2

Please help me.

Original issue reported on code.google.com by mohan848...@gmail.com on 5 Dec 2011 at 6:06

Attachments:

GoogleCodeExporter commented 9 years ago
Hello All,
    Any update on this? Could you reproduce the problem?
Please let me know.

Best regards,
-Mohan

Original comment by mohan848...@gmail.com on 9 Dec 2011 at 6:16

GoogleCodeExporter commented 9 years ago
I've tested your CRTester MFC app and reproduced your problem. It seems that 
MFC replaces the exception handlers installed by CrashRpt by its own exception 
handler functions. I think MFC framework intercepts all unhandled exceptions 
itself and invokes Windows Error Reporting.

I've found an article in MSDN related to MFC exception handling 
http://msdn.microsoft.com/en-us/library/t078xe4f(v=VS.80).aspx It states there 
are two ways of exception handling in MFC: C++ exceptions and MFC exception 
handling macros. No words about using structured exception handling with MFC.

Original comment by zexspect...@gmail.com on 10 Dec 2011 at 3:03

GoogleCodeExporter commented 9 years ago
I've browsed the web some more time and found possible solution of your problem 
http://www.codeguru.com/forum/archive/index.php/t-63950.html

You can override your CWinAppEx::Run() method and install CrashRpt there. In 
CRTester.cpp, add the following code:

int CCRTesterApp::Run() 
{
    BOOL bRun;
    BOOL bExit=FALSE;
    while(!bExit)
    {
        // Call your crInstall code here ...

        bRun= CWinApp::Run();
        bExit=TRUE;

    }
    return bRun;
}

I tried to do this and the exception in CCRTesterView::OnFilePrintPreview() was 
caught by CrashRpt!

Original comment by zexspect...@gmail.com on 10 Dec 2011 at 3:49

GoogleCodeExporter commented 9 years ago
Many thanks to you.
That solved my problem.

Best Regards,
Mohan

Original comment by mohan.sa...@prototechsolutions.com on 13 Dec 2011 at 10:01

GoogleCodeExporter commented 9 years ago

Original comment by zexspect...@gmail.com on 13 Dec 2011 at 12:22