在對話框類中添加如下函數
BOOL CRegister::PreTranslateMessage(MSG *pMsg)
{
if(WM_KEYFIRST <= pMsg->message && pMsg->message <= WM_KEYLAST)
{
if(pMsg->wParam == VK_RETURN ||pMsg->wParam ==VK_ESCAPE)//按回車鍵不響應
{
return true;
}
}
return CDialog::PreTranslateMessage(pMsg);
}