System.Runtime.InteropServices.COMException using C#, IE

liunx

Guest
Hi,

I've been trying to create a utility that attaches to an instance of IE and access the window information. I began by running aximp on shdocvw.dll and adding it as a reference in my project. I can get an instance of IE and access the HTMLDocument in it, like so:

IHTMLDocument2 doc = (IHTMLDocument2) ie.Document;

However, if I try this:

doc.parentWindow.alert("hi");

I get System.Runtime.InteropServices.COMException:

System.Runtime.InteropServices.COMException (0x80040154): Class not registered
at mshtml.HTMLDocumentClass.IHTMLDocument2_get_parentWindow()

Has anyone run into this? Any solution?

ThanksHi,

I've been trying to create a utility that attaches to an instance of IE and access the window information. I began by running aximp on shdocvw.dll and adding it as a reference in my project. I can get an instance of IE and access the HTMLDocument in it, like so:

IHTMLDocument2 doc = (IHTMLDocument2) ie.Document;

However, if I try this:

doc.parentWindow.alert("hi");

I get System.Runtime.InteropServices.COMException:

System.Runtime.InteropServices.COMException (0x80040154): Class not registered
at mshtml.HTMLDocumentClass.IHTMLDocument2_get_parentWindow()

Has anyone run into this? Any solution?

Thanks

Hi Nicholas,

I get an exception while using get_parentWindow() function of IHTMLDocument2 interface in VC++ 6.0. This function works fine on IE6, but on IE7 it throws an exception. The trouble is, on VC++ 6.0, the exception is not one of the standard OleExceptions. So it goes to the catch(...) block. due to this I am unable to find out whats the cause of this exception.

Is Microsoft aware of this thing? I can see you have posted this long back. Have got any answer?

Please let me know if you got over this issue.

Thanks,
Saurabh
 
Back
Top