/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 1st approach. http://msdn.microsoft.com/en-us/magazine/cc301409.aspx BEGIN_MESSAGE_MAP(CMyDlg, CDialog) ON_MESSAGE(DM_GETDEFID, OnGetDefID) .... END_MESSAGE_MAP() LRESULT CMyDlg::OnGetDefID(WPARAM wp, LPARAM lp) { return MAKELONG(0,DC_HASDEFID); } // 2nd approach. BOOL DialogName::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_KEYDOWN) { if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE) { pMsg->wParam=NULL ; } } return CDialog::PreTranslateMessage(pMsg); }
URL: http://www.codersource.net/mfc_dialog_message.html