How does task manager kill my program?

后端 未结 4 612
北恋
北恋 2021-01-18 00:22

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

4条回答
  •  被撕碎了的回忆
    2021-01-18 00:56

    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?

提交回复
热议问题