C++语言 无法通过Esc键关闭窗体
BOOL CWelcomeDlg::PreTranslateMessage(MSG* pMsg) //Called to filter messages before they are dispatched { // TODO: Add your specialized code here and/or call the base class if(pMsg->message == WM_KEYDOWN && pMsg->wParam == 27) { CString s; s.Format("The wParam= %d The message = %d", pMsg->wParam, pMsg->message); MessageBox(s); return NULL; } return CDialog::PreTranslateMessage(pMsg); }
在消息调用之前的函数
学习笔记转摘于:
丝酷网 http://www.pythonschool.com/