Need close message on shutdown

I have an MFC application which continually runs in the
background.  The only time the application closes is when
the machine is shutdown.  The application needs to be able to detect when the machine is shutdown so that it can close cleanly.

When the machine is shutdown, the CMainFrame::OnClose()
function is not being called.  How can we detect that the
machine is being shutdown?
kaplan1Asked:
Who is Participating?
 
Tommy HuiConnect With a Mentor EngineerCommented:
You can catch WM_QUERYENDSESSION to detect when someone requests the Windows session to end.
0
 
Tommy HuiEngineerCommented:
To detect when the session is shutting down, catch WM_ENDSESSION.
0
 
kaplan1Author Commented:
Thanks!
0
All Courses

From novice to tech pro — start learning today.