We help IT Professionals succeed at work.
Get Started

Determining focus of IWebBrowser2

Richard2000
Richard2000 asked
on
1,204 Views
Last Modified: 2010-04-03
Hi,

I am writing IE extensions as a COM tool band and a BHO (Browser Helper Object).  I need to determine if the web browser has the focus or not.  I already have access to the IWebBrowser2 interface, so I really just need a simple function like this to return the focused state of the specified web browser:

function WebBrowserFocused(IE: IWebBrowser2): Boolean;

It should return True when the user is within the page and capable of interacting with it, False otherwise (for example when the user is in the address bar or within a tool band).

Could you please provide the code to implement this?

I've looked at the IWebBrowser2 reference below, but I'm still unsure of how to determine the focus:

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/ifaces/iwebbrowser2/iwebbrowser2.asp

Thanks in Advance,

Richard
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE