Create an MFCProgramTo intercept the wm_queryendsession message and respond to on_wm_queryendsession (). The message response function corresponds to afx_msg bool onqueryendsession (). If you return false directly in this function, Windows wm_queryendsession requests are rejected, windows cannot be shut down normally. (Start> shut down the computer> shut down, log off, and restart ).
When Windows is shut down, it will broadcast a message wm_queryendsession to all top-level windows. Instead of all processes, it should have registered window-class programs. Therefore, the console program does not receive the wm_queryendsession message.
Principle: http://blog.csdn.net/syf442/archive/2009/07/24/4373145.aspx
Post: https://www.xfocus.net/bbs/index.php? Act = sT & F = 3 & t = 43927 & page = all
There is no way to stop the Shutdown Process of the console program:
Http://blog.csdn.net/syf442/archive/2009/07/28/4387132.aspx