From: Peter Melchart on 19 Mar 2006 07:14 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 19 Mar 2006 08:12 "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 20 Mar 2006 20:50 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
|
Pages: 1 Prev: How to resolve fatal error LNK1168 error? Next: MFC examples |