RyomaEchizen

Hi I'm wondering if anyone knows how to detect when a tab changes in IE My toolbar has to detect when

a) A tab changes site (This I already do by Navigate and DocumentComplete)
b) When you change between tabs (this I have no idea how to do).

I know there is a DWebBrowserEvents2::WindowStateChanged I maybe could use but I have no idea how to use it The only thing I've been able to even think about up until now is to create a thread that runs every second and checks what tab is visible, if it's not the one that was visible last check then fetch the document URL location from that, not that I've even gotten that to work very well...

So I was hoping someone might be able to help me out, maybe show me some code on how to achieve knowing when the user changes between tabs and getting the URL from the open tab.


Sincerely
Tom


Re: Internet Explorer Extension Development How to detect tab-change in IE7?

RyomaEchizen

I still haven't found a solution to this, and seemingly none others here have either I heard from someone that he had done it with .NET and an OnDocumentChange event but I can't for the life of me find the equivalent in C++/ATL nor even that one in .NET.

So any takers on a solution




Re: Internet Explorer Extension Development How to detect tab-change in IE7?

IECUSTOMIZER

Hi,

I may be wrong (just been working with IE6 and live toolbar with tabbed browsing and a BHO), but there should be an instance of your toolbar for each tab that is created, so if you are hooking into the loaded document when your toolar is loaded then you should have to do nothing. Use the spyXX utility that comes with .net to inspect the window and tab heiracy of an IE7 window. You will see that for each open tab there is an instance of an IEFrame class and under each of these there will be an instance of your toolbar.

Otherwise you can create a satelite bho for you toolbar that will keep a list of tabs and their document locations (either as registry entries ... as the live toolbar does... or as a shared memory variable.)

Regards.






Re: Internet Explorer Extension Development How to detect tab-change in IE7?

RyomaEchizen

It is not so in IE7, there is one instance for each instance of IE7, each tab isn't it's own instance of IE7 but a window in IE7, so that's not possible.

The only thing I need to find out is what kind of Message/Api is sent to IE/Toolbars when a user switches from one tab to another, doesn't seem to be any (Atleast not that I could find with Spy++, OllyDbg or ApiSpy)




Re: Internet Explorer Extension Development How to detect tab-change in IE7?


Re: Internet Explorer Extension Development How to detect tab-change in IE7?

RyomaEchizen

Yea I can iterate all the tabs and see which one is open, that still won't tell me exactly when the user switches tab. There must be some event or API call that's called for this Or I'll have to setup a 1 second timer that checks which tab is open and run my code if the hwnd != lasthwnd




Re: Internet Explorer Extension Development How to detect tab-change in IE7?

Reza Nourai - MSFT

We have added a new event you can catch...

DISPID_WINDOWSTATECHANGED

It will tell you that the user is switching tabs.

-Reza





Re: Internet Explorer Extension Development How to detect tab-change in IE7?

RyomaEchizen

Why thank you =) Currently I solved it by grabbing the appropriate HWND from SetSite then setting up a WindowsHook for SW_SHOWWINDOW and check when it fires if it's one of the HWND's grabbed in SetSite, if so and ShowWindow is TRUE then that's the tab to be shown.

Now I just need to figure out how to get the IWebBrowser2 from a HWND :P