PRB: Keystroke Problems in CView/CWnd WebBrowser Control
Article ID: 165074
Article Last Modified on 8/18/2005
APPLIES TO
- Microsoft ActiveX SDK
- Microsoft Visual C++ 4.0 Standard Edition
- Microsoft Visual C++ 4.1 Subscription
- Microsoft Visual C++ 4.2 Enterprise Edition
- Microsoft Visual C++ 5.0 Enterprise Edition
- Microsoft Visual C++ 4.2 Professional Edition
- Microsoft Visual C++ 5.0 Professional Edition
This article was previously published under Q165074
SYMPTOMS
When the Web Browser control is embedded in a CView or CWnd class,
keystrokes do not work properly. You may notice following symptoms:
- Tabbing between HTML elements does not work properly.
- Cannot type text in HTML input fields. You can see the carat but cannot
type any characters
CAUSE
This functionality in CView and CWnd classes is by design. The CView and
Wnd classes do not carry the additional overhead necessary to forward these
keyboard messages to children for processing. It is necessary to add this
functionality to your derived class by using PreTranslateMessage.
RESOLUTION
Override PreTranslateMessage for the parent of the Web Browser Control as
follows:
BOOL CMyView::PreTranslateMessage(MSG* pMsg)
{
if(IsDialogMessage(pMsg))
return TRUE;
else
return CWnd::PreTranslateMessage(pMsg);
}
STATUS
This behavior is by design.
Additional query words: c view wnd
Keywords: kbprb KB165074