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. }