PRB: Keystroke Problems in CView/CWnd WebBrowser Control

Last reviewed: January 2, 1998
Article ID: Q165074
The information in this article applies to:
  • Microsoft ActiveX SDK, version 1.0
  • Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1, 4.2, 5.0
  • Internet Explorer 3.0, 3.01, 3.02, 4.0

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.

MORE INFORMATION

Normally, the Web Browser Control is embedded in a dialog box or CFormView. It is possible to dynamically create the control and embed it in a CView or CWnd class. The IEZoom sample illustrates a method of doing this.

For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q156693
   TITLE     : IEZOOM.EXE Changes the Font Size of the Web Browser Control


Additional query words: c view wnd
Keywords : AXSDKWebBrowser kbprb
Version : 1.0 4.0 4.1 4.2 5.0
Platform : NT WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.