wxIEHtmlWin (IWebBrowser2) steals focus

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Knows some wx things
Knows some wx things
Posts: 26
Joined: Sat Oct 25, 2008 3:46 pm

wxIEHtmlWin (IWebBrowser2) steals focus

Post by thile » Tue Aug 02, 2011 11:25 am

I have an application where I can browse different items in a list.
Upon an item is selected, I display information about it in a embedded browser window, beside the list.

Behind the scene I generate some html from the item data and pass it to the embedded IE control.

I use the wxActiveX (wxIEHtmlWin) project to embed IE into the application.

The user will use the arrow keys to navigate though the items. Fast and easy.

Now to the problem, the embedded browser steals the focus, each time new html content is passed to it. User must then use mouse/keyboard to give the item list focus again, to be able to show next item.

Others have experienced this and the suggested solution is to use the IProtectFocus interface.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

I’m just totally lost how to get further. Everything in the wxactivex project is like a blackbox to me.
I have spent hours searching for examples, documentation trying to understand this lowlevel ActiveX/OLE code.

Where/how can I find information to how to implement IProtectFocus, and how do I pass it along to the control?

Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am

Re: wxIEHtmlWin (IWebBrowser2) steals focus

Post by Auria » Tue Aug 02, 2011 12:31 pm

I don't have a direct answer, but... maybe you can take a look at the wxWebView branch in wxWidgets SVN, it features a new component (also based on IE on Windows) and maybe it's easier to follow than wxActiveX (and if you can reproduce the focus issue there, you can maybe suggest to the student coding in this branch to implement the interface ;) )
"Keyboard not detected. Press F1 to continue"
-- Windows

User avatar
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxIEHtmlWin (IWebBrowser2) steals focus

Post by saifcoder » Sun Nov 17, 2019 9:24 pm

this topic was created on 2011, now 2019 and still have the same problem !!
Debian 9 - GCC 6 - wxWidgets 3.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

Part Of The Furniture
Part Of The Furniture
Posts: 4048
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxIEHtmlWin (IWebBrowser2) steals focus

Post by ONEEYEMAN » Mon Nov 18, 2019 3:50 pm

This topic was created during the GSoC when the wxWebView was implemented.
If you can follow AQuria suggestion and implement the missing piece - it would be great. And if you can submit it as a patch/PR - it would be even better.

Thank you.

Post Reply