Click to See Complete Forum and Search --> : How to disable the ENTER key


ed kuijper
June 10th, 1999, 02:40 AM
When in my dialog the ENTER key is hit the dialog exits. How can i disable that.

Dan Haddix
June 10th, 1999, 02:46 AM
Add a handler for PreTranslateMessage to your dialog class like so...

BOOL CYourDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
if (pMsg->wParam == VK_RETURN)
return TRUE;

return CDialog::PreTranslateMessage(pMsg);
}

ed kuijper
June 10th, 1999, 03:10 AM
I think both your time to respond and your solution were perfect.

thanks. :)