What message I receive when I kill my program with task manager

前端 未结 1 712
青春惊慌失措
青春惊慌失措 2021-01-13 11:08

So I have a C++ dll, that I am using in my c# application, for monitoring Windows Messages. I want to know if WM_CLOSE and WM_QUERYENDSESSION are send because I can\'t see t

相关标签:
1条回答
  • 2021-01-13 12:01

    Your process will not get any messages in case if it is being killed. Start on TerminateProcess - see my highlight:

    The TerminateProcess function is used to unconditionally cause a process to exit. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess.

    This function stops execution of all threads within the process and requests cancellation of all pending I/O...

    EDIT: Hans Passant comment on way tasks terminated - You only get WM_CLOSE when using the Applications tab in task manager. Killing it from the Processes tab is a rude termination (TerminateProcess).

    0 讨论(0)
提交回复
热议问题