afx_msg BOOL OnQueryEndSession();
Called when the user chooses to end the Windows session or when an application calls the ExitWindows Windows function. If any application returns FALSE, the Windows session is not ended. Windows stops calling OnQueryEndSession as soon as one application returns FALSE, and sends the WM_ENDSESSION message with a parameter value of FALSE for any applications that have already returned TRUE.
This message-handler member function calls the Default member function. Override this member function in your derived class to handle the WM_QUERYENDSESSION message.
An application should return TRUE if it can be conveniently shut down; otherwise FALSE.
CWnd::Default, ::ExitWindows, CWnd::OnEndSession, WM_QUERYENDSESSION