HOWTO: How to Trap WM_KEYDOWN Messages in a CDialog (117563)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++ for Windows, 16-bit edition 1.51
- Microsoft Visual C++ for Windows, 16-bit edition 1.52
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Learning Edition 4.0
- Microsoft Visual C++, 32-bit Professional Edition 2.0
- Microsoft Visual C++, 32-bit Professional Edition 2.1
- Microsoft Visual C++, 32-bit Professional Edition 4.0
This article was previously published under Q117563 SUMMARY
Certain Windows messages are difficult to trap in a dialog box because they
are either processed by the Windows internal dialog procedure or sent to
the control instead of the dialog box. There are several ways to do this,
but they usually involve subclassing all the controls in the dialog box or
using a Windows hook function. The method described in this article uses
the predefined overridable MFC hook function ProcessMessageFilter() to
capture these messages. The idea is to override the MFC preinstalled hook
function, ProcessMessageFilter(), to trap the messages before they get to
the dialog box.
Modification Type: | Major | Last Reviewed: | 12/2/2003 |
---|
Keywords: | kbArchitecture kbDlg kbHook kbhowto kbKeyIn KB117563 |
---|
|