C++ MFC

Moderators: Lundin
Number of threads: 3354
Number of posts: 9032

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Application Error - Reason and Tracking Posted by rageshctech on 14 Jan 2009 at 4:18 AM
Hi Guys,

I'm writing an application that can track a set of windows application errors.
According to my current understandings, I can use two methods.

1. Enumerate the desktop windows and check for the presence of the specified error message.
2. Set a system wide hook that fires an event on each window creation and check for the error message.


The second method seems to be more efficient as the application can be idle when no window is being created and it will be notified at the time of creation itself, instead of checking in a timer.

So I decided to follow second method.

I successfully tracked the occurance of:
1. Error report dialog
2. Runtime Error (With title: "Microsoft Visual C++ Runtime Library")
3. Out of memory error message.

But i couldn't track the 4th one:
4. Application error ( Please see the screenshot below ).


Now i'll tell you how did I reproduce this error.

Please see the code below:
int *a = new int[3];
a[4]=7;

Write this code under the click event of any button. Build it in release mode and run it. You will have to click that button more than once (count may vary) to reproduce the error.

My problem is that the creation of this window cannot be hooked using the hooking mechanism. I used the WH_CBT hook which can hook the creation of all windows possible including buttons inside the dialog. But if this error message is displayed, nothing happens! No events fired.
The creation of al other error messages can be tracked in this way.

However, I can track this window by enumerating all top level windows in a timer. But I think it will be heavy.

Another thing that surprised me is that I can see this error message even when the system is locked!

Do you have any idea on why this is happening?

I'll be grateful for your responses...

Regards
Ragesh C



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.