directedition
directedition

Reputation: 11703

Multiple tabs in IE7 with one instance of the toolbar

I have developed a toolbar for Internet Explorer in C# to send and receive URLs from an external application. It ran great in IE6, but I wanted to take advantage of tabbed browsing in the new version (IE7), but I've run into a snag there. It seems in IE7, each tab counts a separate instance, and therefore a separate instance of my toolbar.

For the life of me, I can't find a way to have a single instance appear across every tab in a single IE window. All I can figure to do is register as a com object to the ROT and have each instance communicate and mirror all the others, but that seems needlessly complex. Has anyone found a workaround for this?

Upvotes: 5

Views: 742

Answers (2)

Ben Lesh
Ben Lesh

Reputation: 108491

Because you haven't said much about what your toolbar is doing, I'm going to assume that when you have multiple tabs open it's eating some resources... memory, networking, connections on the remote source, etc.

Rather than making sure only one instance is running, my suggestion is to keep track of which tab is active by listening to the WindowStateChanged event, then you could do a variety of things:

  • Shut down your communications while it's inactive.
  • Notify the remote source that the tab isn't active.
  • Simply not show notifications in inactive tabs.
  • Stop any threads you have running in the toolbar.
  • Etc.

Upvotes: 1

J.Wells
J.Wells

Reputation: 1759

Seems to me like you want a mutex, to allow only one instance of the application, or perhaps - one instance of an application feeding all instances of your toolbar.

You could check out msdn for gotchas on synchronization.

Robert Harvey is correct and this has become the standard, but getting IE urls from multiple instances appears rather painless.

Upvotes: 0

Related Questions