Mask Enter Close Dialog Event

xiaoxiao2021-03-06  52

Suppose there is a text box IDC_EDIT_COLORINDEX on the dialog, and then press Enter to enter the text box, the dialog box does not exit, but directly performs some function. The example is onButtonLogin (). If the light is for this behavior, the individual feels that it is not necessary to use a class to handle this thing. It's a bit of killing chicken with a cow knife.

BOOL CMhColorDialog :: PreTranslateMessage (MSG * pMsg) {if (pMsg-> message == WM_KEYDOWN) {if (pMsg-> wParam == VK_RETURN) {UINT nID = GetFocus () -> GetDlgCtrlID (); switch (nID) { Case IDC_EDit_user: onbuttonlogin (); return1; default: return}}}}}}}}}}}

Return CexPandingDialog :: PretranslateMessage (PMSG); // Perform the base class call. }

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

New Post(0)