locked
What is the MessageHandler Called when EndNow button is Clicked? RRS feed

  • Question

  • Hi,
           I have an MFC application on Windows. That application is running and at some point of time it hangs. And when we try to close the application, then windows will pop up a message dialog asking EndNow or continue some thing. If I click on EndNow, then what is the message handler called in MFC. The problem is after selecting EndNow, still I can see the instance of the same application in TaskManager. And I need to go to TaskManager and clean it.

           What I came to know is EndNow action can be caught in the application? Since assume I am running Navigator or Firefox and those are hanged at some point and if I close them through EndNow and if I restart them again they will pop-up a dialog with Restore Previous Session or Start New Session.
         
           With the above scenario I came to know that EndNow can be handled. I don't think so windows will sends SIGKILL or SIGSTOP on EndNow.

    Help me out. And correct me if am wrong any where?

    MFC
    Friday, January 9, 2009 11:52 AM

Answers

  • You are making the wrong assumption about how FF implements its Restore Session feature.  It is very simple, it records state in persistent storage (registry, file).  Recording "I'm running and didn't shut down yet" and a list of open tabs, work in progress so to speak.  When it shuts down, it records "I started to shut down".  When it starts back up, it first checks that persistent stored state.  If it sees "I'm running", it knows it crashed and displays the restore state prompt.  When you click Yes, it records "I'm restoring state".  That ensures that it can't crash over and over again.

    There's no way to trap "End now".  If there was, you wouldn't want to; the state of your program is obviously corrupted.

    Hans Passant.
    Friday, January 9, 2009 12:47 PM