Forwarding events to embedded control


I am trying to embed Internet Explorer into my application. Being not too familiar with windows programming I am using an example obtained from the web that demonstrates how it is done. Everything is working well except for the fact that I am unable to extend the example. For instance I would like Internet Explorer to be able to receive keyboard events, so that for example F5 will cause Internet Explorer to refresh its page. I am attaching the code of the example obtained from the web.

The answer that will earn full points needs to describe how to forward F5 event to the browser.

This question is also related to which has not yet been answered.

Thank you!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Well, if you get a "F5", why not calling 'IWebBrowser2::Refresh()' yourself?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alex123Author Commented:
jkl thank you for replying.

Actually for some reason F5 is not handeled by the WindowProc in this example. I've added print statements and nothing happens on F5, I see mouse events, resize events but not keyboard events.

While I do see sizing events this does not help me, when I try to change internet explorer size to match new window size nothing happens.

If you have any idea what is the cause of this problems please share it :)
As a first step, I suggest that you use the utility program named Spy++ to identify which window is getting the F5 keystroke.

I see that you have tried two different methods to embed the browser control.  There is a third method that is easiest of all:  Just use MFC and create a dialog-based program and use the Resource Editor to add a WebBrowser ActiveX control to the dialog.  That is an excellent way to experiment with the control.  Yes, MFC does a lot of the behind-the-scenes work (and perhaps you don't want those details to be hidden from your program) but it *is* possible to break-point and trace into the MFC code as you explore the workings and learn the basics.
i feel jkr is correct, IE does not provide you complete message forwarding capability. you need to make an object of webbrowser2 and then handle each of the events manually.

alex123Author Commented:
Thank you to all who answered. I will try the suggestions soon and report the result. Btw I do not agree with the point reduction, at the time of accepting the answer I intend to increase the points back to the original level. While the two questions that I've asked have similarities they have different attached code and ask for help in handling different events.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.