4

I have an embedded IWebBrowser2 control using straight C++ (windowed, not windowless) and when someone hits the Tab key to go between fields in the browser, it jumps focus out of the web browser.

Any ideas on what I need to implement or what I could be screwing up?

Thanks!

Bob
  • 255
  • 3
  • 13

2 Answers2

1

Accelerator keystrokes like tab are handled by the message loop before being dispatched. As such a hook function needs to be called by a message loop - IOleInPlaceActiveObject::TranslateAccelerator iirc. - to give the control the chance to do keyboard navigation type things.

Chris Becke
  • 34,244
  • 12
  • 79
  • 148
  • I actually had this set up, but i wasn't properly sending it to the control. But this is definitely what was going wrong, thanks for the help! – Bob May 05 '10 at 20:10
0

I solved this problem by below link.

http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/1f485dc6-e8b2-4da7-983f-ca431f96021f/

IWebBrowser2* iBrowser;
IOleInPlaceActiveObject* pIOIPAO;

hr = mpWebObject->QueryInterface(IID_IWebBrowser2,(void**)&iBrowser);
if ( SUCCEEDED(hr) )
{
iBrowser->QueryInterface(IID_IOleInPlaceActiveObject,(void**)&pIOIPAO);
          if ( SUCCEEDED(hr) )
          {
          pIOIPAO->TranslateAccelerator(msg);
                    pIOIPAO->Release();
          }
          iBrowser->Release();

}
JYP
  • 101
  • 1
  • 5