Intercepting ALT-F4 !

How can I intercept the ALT-F4 sequence for a dialog box and for a MDI application ?

When the user press ALT-F4, a dialog must appear for confirmation. If the user press YES then close application. If the user press NO then do nothing.
mike_marquetAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ZoppoConnect With a Mentor Commented:
Hi mike_marquet,

Add a WM_CLOSE message handler to your window (either the dialog or the mainframe) and there do something like this:

void CMainFrame::OnClose()
{
 if ( AfxMessageBox( "Really want to close ?", MB_YESNO ) != IDYES )
  return;
 CMDIFrameWnd::OnClose();
}

hope that helps,

ZOPPO
0
 
mike_marquetAuthor Commented:
Thanks.
0
All Courses

From novice to tech pro — start learning today.