Last active
December 15, 2015 00:08
-
-
Save botaor/5170223 to your computer and use it in GitHub Desktop.
In Windows MFC if you have a dialog based application, do not exit it with <enter> or <esc>.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CMyDlg : public CDialog | |
{ | |
.... | |
protected: | |
afx_msg void OnCancel(); | |
afx_msg void OnOK(); | |
afx_msg void OnClose(); | |
afx_msg void OnMyExit(); | |
.... | |
}; | |
BEGIN_MESSAGE_MAP(CMyDlg, CDialog) | |
.... | |
ON_WM_CLOSE() | |
.... | |
END_MESSAGE_MAP() | |
void CMyDlg::OnOK() | |
{ | |
// We do not want to close in this situation | |
} | |
void CMyDlg::OnCancel() | |
{ | |
// We do not want to close in this situation | |
} | |
void CMyDlg::OnClose() | |
{ | |
CDialog::OnCancel(); | |
} | |
void CMyDlg::OnMyExit() | |
{ | |
OnClose(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment