How to receive a message that an application has crashed?

Posted on 2012-09-04
Last Modified: 2012-09-17

I am working on an application that changes some settings in the disk manager after it launches. It undoes all those changes when it is closed properly.

However when the application crashes because of some reason, it can't undo the changes it did. I am planning to write some sort of a service, which waits for a notification that the application has crashed, and undoes all the changes done by the application.

Is there anyway for one application or a process to be informed when another application crashes? I mean is there any sort of event or message that windows throws for this case?
Question by:raj_ksrt
    LVL 2

    Expert Comment

    you might want to look at Servers Alive application.  It can carry out actions off the back of a failure.
    LVL 21

    Assisted Solution

    Write it as a service and have your service installer specify the Recovery option of running another application on the first failure.
    LVL 9

    Accepted Solution

    One simple option might be to wrap your application in another application.
    For example, create a class called, for example, MainApplication. Give it a method called Run that takes no parameters and returns no values, eg:
    void MainApplication::Run()

    transfer all the functionality of your existing program to this class, and all the code from your main() function to the Run() method.
    Now create a wrapper program, I will call it TestHarness.
    In the main function create an instance of your class inside a try-catch block and call the run method.
    If it crashes it should raise an exception which your harness program can capture. You will then know immediately if iit has crashed.
    You can then perform whatever cleanup stuff you need to.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Many companies are making the switch from Microsoft to Google Apps ( Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
    The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
    Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now