想要在嵌入标准 C# 应用程序的 WebBrowser 控件中启用 BHO
我有一个标准的 winforms C# 应用程序,其中拖有一个网页浏览器控件。我们还有一个 C++ BHO,当它在 IE7 或 IE8 中运行时,我们通常通过 COM 与之交互。
我没有看到任何方法告诉 web 浏览器控件加载 BHO。 BHO 不显示任何 GUI 或任何东西,它只是在从 IE 使用时监听 http 流量。
任何帮助将不胜感激。 谢谢。
I have a standard winforms C# app with a webbrowser control dragged onto it. We also have a C++ BHO that we generally interact with through COM when it runs inside IE7 or IE8.
I don't see any way to tell the webbrowser control to load the BHO. The BHO doesn't show any GUI or anything, it just listens to the http traffic when used from IE.
Any help would be greatly appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
BHO 只是实现 IObjectWithSite 的 COM 对象。您只需创建 BHO 的实例,查询 IObjectWithSite 并调用 IObjectWithSite::SetSite,将 Web 浏览器控件的 IWebBrowser2 指针作为参数传递即可。当您关闭时,再次调用 SetSite,传递 NULL。
如果您托管其他人编写的 BHO,您也需要满足他们的要求,有些可能要求您的程序命名为“iexplore.exe”,有些可能要求您具有与特定版本的 IE 相同的窗口层次结构,等等。
BHOs are just COM objects who implement IObjectWithSite. You can just create a instance of your BHO, query for IObjectWithSite and call IObjectWithSite::SetSite, passing IWebBrowser2 pointer of the webbrowser control as a parameter. When you are shutting down, call SetSite again, passing NULL.
If you are hosting BHOs written by others you need to satisfy their requirement as well, some may require your program to be named "iexplore.exe", some may require you to have the same window hierarchy as a particular version of IE, etc.