WM_KEYDOWN on Non-MFC Dialog
-
I am trying to find a means for capturing the wm_keydown on a dialog box developed using C++ so that means no MFC, no CDialog, etc. It is the old-fashioned capture of the WM_INITDIALOG, WM_COMMAND, etc. I need to capture a keystroke, determine if it is a specific key, and then perform specific processing. All the information I have been able to find deals with the WM_KEYDOWN on MFC dialog boxes, I haven't been able to find anything in regard to how to handle the messaging if it is a Non-MFC dialog box. Any ideas?
-
I am trying to find a means for capturing the wm_keydown on a dialog box developed using C++ so that means no MFC, no CDialog, etc. It is the old-fashioned capture of the WM_INITDIALOG, WM_COMMAND, etc. I need to capture a keystroke, determine if it is a specific key, and then perform specific processing. All the information I have been able to find deals with the WM_KEYDOWN on MFC dialog boxes, I haven't been able to find anything in regard to how to handle the messaging if it is a Non-MFC dialog box. Any ideas?
-
I appreciate the suggestions. When I create the window programmatically, the WM_KEYDOWN works like a charm but since this is a dialog box, it doesn't appear to work the same way. As a test, I implemented a WM_KEYDOWN in the dlgProc and it was never captured. I am thinking there is something special that needs to be done to capture the keystroke for a non-mfc dialog box, outside of the standard implementation of the WM_KEYDOWN message.
-
I appreciate the suggestions. When I create the window programmatically, the WM_KEYDOWN works like a charm but since this is a dialog box, it doesn't appear to work the same way. As a test, I implemented a WM_KEYDOWN in the dlgProc and it was never captured. I am thinking there is something special that needs to be done to capture the keystroke for a non-mfc dialog box, outside of the standard implementation of the WM_KEYDOWN message.
Remember that keystroke events go to the window with keyboard focus. In a dialog that is often one of the controls. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Remember that keystroke events go to the window with keyboard focus. In a dialog that is often one of the controls. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Ah, very true, an obvious point that I have overlooked in this case. I would bet that you are correct, the message is going to one of the controls and not the dialog window.
-
I appreciate the suggestions. When I create the window programmatically, the WM_KEYDOWN works like a charm but since this is a dialog box, it doesn't appear to work the same way. As a test, I implemented a WM_KEYDOWN in the dlgProc and it was never captured. I am thinking there is something special that needs to be done to capture the keystroke for a non-mfc dialog box, outside of the standard implementation of the WM_KEYDOWN message.
Mark Salsbery
hit the target: I saw, with spy tool, WM_KEYDOWN messages going to Dialog OK button! :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Remember that keystroke events go to the window with keyboard focus. In a dialog that is often one of the controls. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder