views:

76

answers:

1

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  A: 

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.

Sheng Jiang 蒋晟
Thanks Sheng, I'll give this a go.
Shane