vs2005/2008 MFC dialog box, hit enter, ESE key, the program automatically exits the solution

Find the class where the dialog is located, right-click the attribute, and then find PreTranslateMessage in the reload message

BOOL Ctt2_capDlg::PreTranslateMessage(MSG* pMsg)
{     // TODO: add special code here and/or call the base class     if(pMsg->message==WM_KEYDOWN)     {         if(pMsg->wParam==VK_ESCAPE)             return TRUE;         if(pMsg->wParam==VK_RETURN)             return TRUE;     }








        

    return CDialog::PreTranslateMessage(pMsg);
}

 

Guess you like

Origin blog.csdn.net/txwtech/article/details/114357901