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
Yes, both of these are correct. You should respond to WM_CLOSE to close gracefully. This could come from anywhere, not just task manager (shutdown for instance).
MFC normally handles WM_CLOSE. If your app is not responding then your main thread must be sat doing something else, or more likely from your description is crashing somewhere in the WM_CLOSE handler.
Can you debug your app to find where the exception is being raised?