Mask for the ESC and Enter keys in the Dialog dialog

xiaoxiao2021-03-05  29

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);

转载请注明原文地址:https://www.9cbs.com/read-34087.html

New Post(0)