Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Focus

88 views
Skip to first unread message

Bartosz Milewski

unread,
Jul 15, 2006, 3:56:01 PM7/15/06
to
How do I give focus to the embedded browser control? Somehow, in my
application, the browser is activated and displays the page, but it doesn't
have the keyboard focus. It gets focus only after I click on it with the
mouse.

Igor Tandetnik

unread,
Jul 16, 2006, 12:03:51 AM7/16/06
to
"Bartosz Milewski" <Bartosz...@discussions.microsoft.com> wrote in
message news:60CB327A-C019-4821...@microsoft.com

> How do I give focus to the embedded browser control?

Query it for IOleObject, call DoVerb(OLEIVERB_UIACTIVATE)
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Bartosz Milewski

unread,
Jul 26, 2006, 3:34:01 PM7/26/06
to
Thanks Igor--I was able to implement this call, but it hasn't solved my
problem. I don't know how it happens, but the browser still loses the focus.
I use exactly the same techniques when the embedded window is a listview
rather than web browser, and it works. Any insights about what could be going
on? I'm at my wits end.

Bartosz Milewski

unread,
Jul 26, 2006, 9:15:01 PM7/26/06
to
Okay, I got it working by trial and error. Apparenlty I was setting focus too
early in the process of displaying the control. I put the focus call now
after calling Navigate, and the focus holds. I wander if there is a better
place yet.

Jeff

unread,
Oct 30, 2008, 10:08:01 AM10/30/08
to
I guess it looks like I'm having a similar problem exception I am dealing
with the Windows Forms wrapper for the WebBrowser control. I'm curious if
this same suggestion would work in my case where I have had problems
regaining focus after it is taken from another window. What I have too look
into now is the proper way to obtain the IOleObject interface from the
Windows Forms WebBrowser control.

More information on the issues I'm facing can be found at the following link.

Focus issues with System.Windows.Controls.WebBrowser
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1b50fec6-6596-4c0a-9191-32cd059f18f7

0 new messages