Re: Escape key

Tech-Archive recommends: Speed Up your PC by fixing your registry



Escape is handled by the DefDlgProc.

"David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:HB1yh.3663$MN.1106@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"Ajay Kalra" <ajaykalra@xxxxxxxxx> wrote in message
news:1170775864.294690.290940@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Duh... I guess look for it explicity in Pretraslate message woudl be
one way to do it:
BOOL CDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN &&
(pMsg->wParam == VK_ESCAPE))
return TRUE;

return CDialog::PreTranslateMessage(pMsg);
}


Yes, this would work very well. Maybe my tip about removing the
accelerator is bogus; there may not even be a VK_ESCAPE accelerator since
Escape only closes a CDialog, not a CWnd/CMainFrame

-- David (MVP)



.



Relevant Pages

  • Re: problem with WM_KEYDOWN
    ... BOOL CWipeDlg::PreTranslateMessage(MSG* pMsg) ... /// This code Nullify the effect of the ESCAPE and RETURN key on the ...
    (microsoft.public.vc.mfc)
  • Re: how to disabel Esc key in WINCE dialog
    ... BOOL CXYZAppDlg::PreTranslateMessage(MSG* pMsg) ... // handle yr escape button handler ...
    (microsoft.public.windowsce.app.development)
  • Re: Int array test for all values zero
    ... bool IsAllZero ... Add all values in array in sum and check if sum is zero. ... It can escape the loop early. ... As it uses the short circuit operator &&, it will also escape from the expression as early as possible. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Escape key
    ... BOOL CDlg::PreTranslateMessage(MSG* pMsg) ... Maybe my tip about removing the accelerator ...
    (microsoft.public.vc.mfc)