This page looks like it discusses the relevant .NET / COM Interop stuff.
http://msdn.microsoft.com/en-us/library/aa645736(VS.71).aspx
Looks like something like the following is needed...
using System.Runtime.InteropServices;
// Declare GearsBHO as a COM coclass
[ComImport, Guid("...")]
class GearsBHO
{
}
// Declare IObjectWithSite as a COM interface which
// derives from the IDispatch interface.
[Guid("..."), InterfaceType(ComInterfaceType.InterfaceIsDual)]
interface IObjectWithSite // cannot list any base interfaces here
{
// Note that the members of IUnknown and Interface are NOT
// listed here
void SetSite([In, MarshalAs(UnmanagedType.Interface)] object unk );
}
void initGears(object browserControl) {
// Create an instance of a COM coclass:
GearsBHO gearsBHO= new GearsBHO ();
// See if it supports the IObjectWithSite COM interface.
// Note that this will throw a System.InvalidCastException if
// the cast fails. This is equivalent to QueryInterface for
// COM objects:
IObjectWithSite iobjectWithSite = (IObjectWithSite ) gearsBHO;
// Call it
objectWithSite.SetSite(browserControl);
}