想要在嵌入标准 C# 应用程序的 WebBrowser 控件中启用 BHO

发布于 2024-09-12 17:50:34 字数 200 浏览 3 评论 0原文

我有一个标准的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瑶笙 2024-09-19 17:50:34

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文