标准命令消息ID_APP_EXIT
分类:
当用户从“文件”菜单选择执行“退出”时,将发送MFC标准命令消息ID_APP_EXIT。MFC实现的函数CWinApp::On
CWinApp::On
protected: //{{AFX_MSG(CWinApp) afx_msg void On afx_msg void On afx_msg BOOL On //}}AFX_MSG DECLARE_MESSAGE_MAP() |
它对应的消息映射在文件appcore.cpp中
BEGIN_MESSAGE_MAP(CWinApp, CCmdTarget) //{{AFX_MSG_MAP(CWinApp) // Global File commands ON_COMMAND(ID_APP_EXIT, &CWinApp::On // MRU - most recently used file menu ON_UPDATE_COMMAND_UI(ID_FILE_MRU_FILE1, &CWinApp::On ON_COMMAND_EX_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE16, &CWinApp::On //}}AFX_MSG_MAP END_MESSAGE_MAP() |
实现在文件appui.cpp中
void CWinApp::On { // same as double-clicking on main window close box ASSERT(m_pMainWnd != NULL); m_pMainWnd->SendMessage(WM_CLOSE); |