IE7中的多个选项卡以及一个工具栏实例 [英] Multiple tabs in IE7 with one instance of the toolbar

查看:77
本文介绍了IE7中的多个选项卡以及一个工具栏实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为C#中的Internet Explorer开发了一个工具栏,用于从外部应用程序发送和接收URL.它在IE6中运行良好,但我想利用新版本(IE7)中的选项卡式浏览功能,但在那里遇到了麻烦.似乎在IE7中,每个选项卡都包含一个单独的实例,因此,我的工具栏也包含一个单独的实例.

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.

在我生命中,我找不到在单个IE窗口的每个选项卡上都出现单个实例的方法.我所能做的就是将其注册为ROT的com对象,并使每个实例进行通信并镜像所有其他实例,但这似乎不必要地复杂.有没有人找到解决方法?

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?

推荐答案

由于您对工具栏的工作还不多说,我假设当您打开多个选项卡时,它正在消耗一些资源. .内存,网络,远程源上的连接等.

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.

我的建议不是通过确保只运行一个实例,而是通过侦听WindowStateChanged事件来跟踪哪个选项卡处于活动状态,然后您可以执行多种操作:

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:

  • 在闲置状态下关闭通讯.
  • 通知远程源该选项卡未激活.
  • 仅在不活动的标签中不显示通知.
  • 停止在工具栏中运行的所有线程.
  • 等等.

这篇关于IE7中的多个选项卡以及一个工具栏实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆