Roger Lipscombe
Roger Lipscombe

Reputation: 91825

Enumerating open tabs in Internet Explorer?

I'd like to find a way to enumerate the open tabs (and corresponding URLs) of the open tabs in Internet Explorer. I've found this question, which suggests that it's not possible to do this in general, but I'm looking specifically at solutions for IE7 and IE8.

I'd prefer Win32-only solutions (I don't want to take a dependency on .NET, if possible).

I'm open to writing some kind of plugin for Internet Explorer, if that's necessary. Any pointers?

Upvotes: 2

Views: 962

Answers (1)

i_am_jorf
i_am_jorf

Reputation: 54600

IE does not expose a supported way of enumerating tabs. What you have to do is write a BHO that sinks DWebBrowserEvents2::WindowStateChanged. Your BHO will be loaded once per tab, and you'll get a WindowStateChanged event whenever the user switches tabs to the old and new tab. Then you just have to keep a global map of BHOs to Tabs and a pointer to which is the active tab based on WindowStateChanged events.

Note: You can write a toolbar, instead of a BHO, that does the same thing. Just depends on if you want UI or not.

Upvotes: 2

Related Questions