Tab key ignored in WebBrowserComponent(Windows)


It appeared to be a common issue regarding ActiveX + IE.
We need to call TranslateAccelerator() so the IE will be able to process the tab key.

I’m new to Windows/ActiveX programming so I don’t really know where is the place in the code to do it.

I saw some snippets of code that do it in a CALLBACK functions like the CALLBACK activeXHookWndProc() in juce_win32_ActiveXComponents,
others do it in a HHOOK objects.

I tried but failed to add it to Juce.

Plz help.

Looks like the callback should be attached using this block:

::ZeroMemory (&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.hInstance = instance_;
wc.lpfnWndProc = this->WindowProc; <- attaching the callback
wc.lpszClassName = “subkdls490”;

Where do I add it in Juce??


You can’t just create a new window class - the window already has a class! I guess I’d have to add the TranslateAccelerator call somewhere in the normal wndproc routine. How is it supposed to be called?

In the callback you need to add a OnKeyDown() function to a WM_KEYDOWN event
that looks something like this:

LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
CComQIPtr<IOleInPlaceActiveObject, &IID_IOleInPlaceActiveObject>

if ( pIOIPAO )
	MSG msg;
	msg.message = uMsg;
	msg.wParam = wParam;
	msg.lParam = lParam;

	hr = pIOIPAO->TranslateAccelerator(&msg);
return hr;


wow… not really sure how it’d be best to crow-bar that into it…

To add it would mean that the normal win32 stuff would have to have a special case for detecting the activex comps - all a bit messy!

I agree.
I don’t mind doing it quick and dirty for now.
Can you suggest me a way to grab the browser in the peerWindowProc(), that’s all I’m missing:


IOleInPlaceActiveObject* ipao;

IWebBrowser2 browser = / get the browser /
browser->QueryInterface(IID_IOleInPlaceActiveObject, reinterpret_cast<void
if (ipao) {
MSG m;
m.wParam = wParam;
m.lParam = lParam;
m.hwnd = hwnd;


I guess you might be able to use win32 calls to find a suitable child HWND, then find its ComponentPeer, get its component and then attempt a dynamic_cast <WebBrowserComponent*>… all pretty icky, I’m afraid!

Thanks, I’ll try it.

Shlomi: Did you manage to create a working fix for this issue?

jules: Any chance of getting an official fix for this in the juce codebase?

We’ve run into the problem when we use a browser component showing a web page where there’s form fields to fill with info. Not being able to tab between the fields rather breaks the user experience I’m afraid…

I’ve no time to investigate it myself right now, but if anyone can suggest a good fix for it, I’d certainly be happy to look at that.

Hi Markus.

It’s still in my to-do list, sorry.

Ah, too bad. Thank you anyways.


Is the issue fixed ?


I believe so, testing on Windows 10 the tab key works as expected in WebBrowserComponent.

Oh did u test on reaper?

I have another issue, WWebBrowserComponent do not send key event => ajax on web site does not work