4

I have an MFC CDialog with an IWebBrowser2 in it. I get to a page that has a HTML text area, I can input text but backspace doesn't erase it.

in need of help
  • 1,606
  • 14
  • 27
  • You get the same behavior if you explicitly click inside the HTML page (i.e. setting focus)? Does the `DEL` key work? And what about `Ctrl+Backspace`? – l33t Oct 04 '12 at 06:57
  • Same for Ctrl+Backspace (what is this supposed to do?). Del works fine, the arrow keys work fine. Yes I explicitly click inside the HTML page and give focus to it and then to the Text box within the HTML page. – in need of help Oct 04 '12 at 11:10
  • Then only thing I can think of is some kind of focus problem. Backspace means 'Go back' if focus is outside a textbox... Does this problem occur in a new, clean Dialog-based project? – l33t Oct 04 '12 at 12:19
  • Can I programatically set the focus to be on the browser component rather than the CDialog? – in need of help Oct 04 '12 at 13:03
  • I believe you have to dig for the `HWND` of the browser. E.g. `FindWindow("Internet Explorer_Server", NULL)` – l33t Oct 04 '12 at 21:10

1 Answers1

3

When an ATL ActiveX control that subclasses an edit control is hosted in Internet Explorer, pressing the BACKSPACE key when focus is set to the Edit control causes Internet Explorer to navigate to the previous Web page. If there are no Web pages previous to the one with the control, the BACKSPACE key functions as normal.

When the user clicks on the subclassed control, the control is not UI Activated. This means that any accelerator keys are processed by the Internet Explorer frame. The control is never given a change to process the BACKSPACE accelerator key.

refer: http://support.microsoft.com/kb/190044

mfc
  • 46
  • 1