Search code examples
c#internet-explorercom-interop

How can I use IHTMLDocument6 or other IE 8 interfaces from C#?


I'm trying to access the IHTMLDocument6.documentMode property from my IE BHO, but that interface is not defined in any of the mshtml assemblies I can find on my machine.

I've tried hacking together an interface definition for the interface:

[Guid("30510417-98b5-11cf-bb82-00aa00bdce0b")]
[TypeLibType(4160)]
public interface IHTMLDocument6
{
    [DispId(1104)]
    float documentMode { get; }
}

I can successfully cast the document object to this interface, but I do not get a value that makes sense for the documentMode property.

Where can I find the version of mshtml that includes the IHTMLDocument6 interface, or a correct version of the interface definition to use? Or is there some other way I should be doing this?

Thanks.


Solution

  • You can always use latebinding and do a Type.Invokemember

    http://msdn.microsoft.com/en-us/library/66btctbe.aspx