From: Peter Melchart on
hi,
i want to catch VK_ESC in a hotkey control. the hotkey control is
embedded in a dialog (of course). to prevent the dialog from closing on
ESC i added the following code to the dialogs PreTranslateMessage method:

if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE))
{
mHotkeyCtrl.SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
{
return TRUE;
}
}

the dialog doesn't get closed now but mHotkeyCtrl doesn't react to the
message. If i send other wParam values like 'A' or any other regular
key, the hotkey control responses in the expected way.

Also it's not possible to catch VK_SPACE in the control.

any ideas?

Peter
From: Jeff Partch [MVP] on
"Peter Melchart" <dont(a)spam.me> wrote in message
news:uO7If60SGHA.4384(a)tk2msftngp13.phx.gbl...
> hi,
> i want to catch VK_ESC in a hotkey control. the hotkey control is embedded
> in a dialog (of course). to prevent the dialog from closing on ESC i added
> the following code to the dialogs PreTranslateMessage method:
>
> if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE))
> {
> mHotkeyCtrl.SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
> {
> return TRUE;
> }
> }
>
> the dialog doesn't get closed now but mHotkeyCtrl doesn't react to the
> message. If i send other wParam values like 'A' or any other regular key,
> the hotkey control responses in the expected way.
>
> Also it's not possible to catch VK_SPACE in the control.
>
> any ideas?
>

FWIW, The WM_HOTKEY documentation says that, "VK_ESCAPE, VK_SPACE, and
VK_TAB are invalid hot keys", and the hotkey "Default Message Processing"
documentation says that for WM_KEYDOWN the control just, "Calls the
DefWindowProc function if the key is ENTER, TAB, SPACE BAR, DEL, ESC, or
BACKSPACE".
--
Jeff Partch [VC++ MVP]


From: fcvcnet on
Something about Message Reflection , am I right?

"Peter Melchart" <dont(a)spam.me>
??????:uO7If60SGHA.4384(a)tk2msftngp13.phx.gbl...
> hi,
> i want to catch VK_ESC in a hotkey control. the hotkey control is
> embedded in a dialog (of course). to prevent the dialog from closing on
> ESC i added the following code to the dialogs PreTranslateMessage method:
>
> if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE))
> {
> mHotkeyCtrl.SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
> {
> return TRUE;
> }
> }
>
> the dialog doesn't get closed now but mHotkeyCtrl doesn't react to the
> message. If i send other wParam values like 'A' or any other regular
> key, the hotkey control responses in the expected way.
>
> Also it's not possible to catch VK_SPACE in the control.
>
> any ideas?
>
> Peter