In the dialog program generated by the MFC, the default Press the ESC button will cause the program to exit, and press Enter to make the program lookup dialog box in which button is turned on, so that the button is executed.
In order to block the two keys, it can be used overload the PretraMessAg function.
details as follows:
Bool cmcisingdlg :: PretranslateMessage (MSG * PMSG) {IF (pmsg-> message == wm_keydown && (pmsg-> wparam == vk_escape || pmsg-> wparam == vk_return) Return True;
Return CDIALOG :: PretranslateMessage (PMSG);