Unable to cast mshtml.IHTMLDocument2 to IMarkupServices2 using mshtml Interop

Hi,

I am unable to cast mshtml.IHTMLDocument2 to IMarkupServices2 in C#. I am using Microsoft.mshtml Interop assembly (version 7.0).

The code snippet is

IHTMLDocument2 pdoc;

<pdoc assigned to a non-null value..............>

IMarkupServices2 markup = pdoc as IMarkupServices;

...> value of markup here is NULL even though pdoc is non-null and the msdn documentation indicate that IHTMLDocument2 can be used to get a reference to IMarkupServices2

To be more specific, i am able to get a non-null reference to IMarkupServices in case of a .Net Webbrowser control in a sample winforms application.

However when i try to get a similar reference to that of a running IE instance, i get NULL when i cast the non-null IHTMLDocument2 reference of the IE's browser control to IMarkupServices..

Is IMarkupServices inaccessible out of proc ..

Thanks,

Shiva



Answer this question

Unable to cast mshtml.IHTMLDocument2 to IMarkupServices2 using mshtml Interop

  • Unable to cast mshtml.IHTMLDocument2 to IMarkupServices2 using mshtml Interop