I'm trying to use SHDocVw.InternetExplorer to navigate a
website. The problem I'm running into is that the
HTMLDocument (I think it's IHTMLDocument2 or above, but
this is the class name in the dll I get for C# interop)
that is returned after a navigate doesn't
seem to support the frames property even on a page that
has a frameset. I've been able to successfully use this
property on a document when using AxSHDocVw.AxWebBrowser,
just not when using SHDocVw.InternetExplorer.
I get the message 'No such interface supported' in the
catch block below. Below is the DocumentComplete method
I'm using when the navigate is done. Can anyone suggest
how I can find the documents in a frameset when using
InternetExplorer rather than AxWebBrowser? Or perhaps
catch what I may be doing wrong? Thanks.
private static void DocumentComplete(object sender, ref
object e)
{
lock(typeof(IeTest))
{
mshtml.HTMLDocument doc =
(mshtml.HTMLDocument) ie.Document;
try
{
//this throws the
exception
Console.WriteLine("frames length: " +
doc.frames.length);
}
catch(Exception ex)
{
Console.WriteLine("ERROR: " +
ex.Message);
}
// Notify main method
Monitor.Pulse(typeof(IeTest));
}
}
> that is returned after a navigate doesn't
> seem to support the frames property even on a page that
> has a frameset.
A (possibly) related issue was discussed on our website for the
htmlEditor control (C#). You can find the link here:
http://itwriting.com/phorum/read.php?f=3&i=45&t=45
It appears that a security issue prevents full access to the
frames collection through the scripting interface. It should
be OK through the lower level API. I intend to have a look at
this for the control at some stage but haven't done so yet.
I don't know if I'm on the right track here, but it might be
worth a look.
Tim
Free C# html editor: http://www.itwriting.com/htmleditor/index.php
Thanks for the pointer. I'm a bit stuck on it at this
point.
-Chris
>.
>
> Thanks for the pointer. I'm a bit stuck on it at this
> point.
Code similar to yours seems to work fine with the
htmlEditor's document property - but that is with
frames from the same domain. Are yours in fact
from a different domain? If so, you may be out of
luck. If they are from the same domain, you should
be able to get it working. I'm not sure why you get
"no such interface supported"; I'd expect a
permission denied error.
Have you tried casting to a different interface, say
IHTMLDocument2?
Tim
Free html viewer/editor http://www.itwriting.com/htmleditor/index.php
There is no difference whatsoever in using the Browser control and the
Internet Explorer, once you have connected to the corresponding object.
So the question is: how do you establish the browser object?
In VB you would do something like:
Dim WithEvents InternetExplorer1 As SHDocVw.InternetExplorer
Dim WbrDoc As MSHTML.HTMLDocument
Dim WbrFrameDoc As MSHTML.HTMLDocument
Set InternetExplorer1 = New SHDocVw.InternetExplorer
InternetExplorer1.Navigate "http://www.yourserver.com"
Private Sub InternetExplorer1_DocumentComplete(ByVal pDisp As Object, URL As
Variant)
On Error Resume Next
If pDisp Is InternetExplorer1.Object Then 'Crucial!!! Make
sure, it is the "DocumentComplete" for the top-level object
'Only then you are sure, that the document object exists!!!!
Set WbrDoc = pDisp.Document
Set WbrFrameDoc = WbrDoc.frames(FrameName$).Document
End If
End Sub
--
Dipl.-Ing.(TH) Winfried Kaiser
Fortune Systems GmbH & Co.
D-24975 Husby
Germany
"Chris Hogue" <c...@indra.com> schrieb im Newsbeitrag
news:063501c2b0db$e81fcdc0$d7f82ecf@TK2MSFTNGXA14...