PRB: KeyPress Problem When Using MFC Control on MDI Child Form (197504)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q197504 SYMPTOMS
You insert controls created in Visual C++ using the Microsoft Foundation
Classes (MFC) on a multiple-document interface (MDI) child form. Your MFC
control includes the stock event KeyPress and you display a message box in
the KeyPress event handler. After you click this control, on a MDI child
form and press a key, the event fires. However, if you press a key again,
the event does not fire.
CAUSE
When the message box displays and is then dismissed, the MFC control loses
the input focus. Consequently, the next key press message is not sent to
the control.
RESOLUTION
To resolve the problem, you can set the focus back to that control after
the KeyPress event fires.
STATUS
This behavior is by design.
REFERENCES
For other problems related to using MFC controls in MDI forms, please see
the following articles in the Microsoft Knowledge Base:
192347
PRB: Focus/Activation Problems with MFC Control on VB Forms
197503
PRB: Focus Problem When MFC Control is Used on MDI Child
Form
| Modification Type: | Major | Last Reviewed: | 5/13/2003 |
|---|
| Keywords: | kbcode kbCtrlCreate kbprb KB197504 |
|---|
|