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
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).