Unexpectedly, I found myself needing to use IHTMLDocument5/6 last evening to fetch a few properties that aren’t directly exposed via any of the Web Browser options in classic .NET programming (like WinForms/WPF). I couldn’t find them anywhere, so I whipped up something simple/quick/dirty:
[Guid("3050f80c-98b5-11cf-bb82-00aa00bdce0b")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)] internal interface IHTMLDocument5 { void SetOnmousewheel(object p); object GetOnmousewheel(); object docType { get; } object implementation { get; } object createAttribute([In] string attrName); object createComment([In] string comment); void SetOnfocusin(object p); object GetOnfocusin(); void SetOnfocusout(object p); object GetOnfocusout(); void SetOnactivate(object p); object GetOnactivate(); void SetOndeactivate(object p); object GetOndeactivate(); void SetOnbeforeactivate(object p); object GetOnbeforeactivate(); void SetOnbeforedeactivate(object p); object GetOnbeforedeactivate(); string compatMode { get; } } [Guid("30510417-98b5-11cf-bb82-00aa00bdce0b")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)] internal interface IHTMLDocument6 { object compatible { get; } object documentMode { get; } void SetOnStorage([In] object p); object GetOnStorage(); void SetOnStorageCommit([In] object p); object GetOnStorageCommit(); object getElementById([In] string id); void updateSettings(); }
As you can see, I didn’t spend a lot of time with the details, but it was enough to make progress (in particular I wanted compatMode and documentMode).