Want to enable BHO in a WebBrowser Control embedded in a standard C# App

老子叫甜甜 提交于 2019-12-06 08:05:11

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3419653/want-to-enable-bho-in-a-webbrowser-control-embedded-in-a-standard-c-sharp-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!