Application Close button

How do I grab the signal hit when the user clicks on the close button (the X in the upper right hand corner)?

I've got a function that's called when the ID_APP_EXIT message is sent but this isn't being hit when the close button is clicked, as I'd expected. And for some reason I can't find it in the MFC Devstudion 5.0 documentation.
winkleAsked:
Who is Participating?
 
umaramaConnect With a Mentor Commented:
In Mainframe ....
Add the following handler

ON_WM_SYSCOMMAND()

afx_msg void CMainFrame::OnSysCommand( UINT nID, LPARAM lParam )
{

   if (nID == SC_CLOSE)
   {
      // Do your processing
   }
}
0
 
thresher_sharkCommented:
Is there any particular reason you accepted my answer and then posted another question that asked the exact same thing winkle?  If you needed help, I think I could have provided it :-)
0
 
umaramaCommented:
To thresher_shark

Me think, we both answered winkle's question at the same time !!
He liked your answer and accepted it. Winkle is probabily not aware of this answer !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.