I have this MFC program that when I kill it with task manager I get an exception on my program and then it crashes.
I want to get the event from the task manager, wh
When you get a WM_CLOSE, you can easily detect that so your application can act upon it.
I don't believe it's possible to know when TerminateProcess is being called to kill your application. The TerminateProcess
documentation says it's an immediate and unconditional shutdown of the target process.
(Depending on how much you want to achieve this, take a look at this link about hooking into the Windows API but don't expect it to be easy.)