Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Application Error - Reason and Tracking

rageshctechrageshctech Posts: 20Member
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.

[italic]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.[/italic]

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 ).
[img=http://img108.imageshack.us/img108/7943/applicationerrorwg3.jpg]

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

Please see the code below:
[code]
int *a = new int[3];
a[4]=7;
[/code]
Write this code under the click event of any button. Build it in release mode and run it. [b]You will have to click that button more than once (count may vary)[/b] to reproduce the error.

My problem is that the [b]creation of this window cannot be hooked [/b]using the hooking mechanism. I used the [italic]WH_CBT hook which can hook the creation of all windows possible including buttons inside the dialog[/italic]. 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 [b]I can see this error message even when the system is locked![/b]

Do you have any idea on why this is happening?

I'll be grateful for your responses...

Regards
Ragesh C
Sign In or Register to comment.