By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,473 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,473 IT Pros & Developers. It's quick & easy.

loading a url using mshtml

P: n/a
ddd
I am trying to use MSHTML without the webbrowser and I am having a few
problems. Right now all I am trying to do is load an URL(html page) and
access its innerhtml.

What I have is:

Dim doc As mshtml.HTMLDocument = New mshtml.HTMLDocument()
Dim d1 As mshtml.IHTMLDocument4 = doc
Dim d2 As mshtml.IHTMLDocument4 = doc
d2.write("<html><body>test</body></html>")
d2.close()
MsgBox(d2.body.innerHTML)
d2 = d1.createDocumentFromUrl("http://www.msnbc.com", "")
MsgBox(d2.readystate)

It seems like I am able to load the url correct (ran a packet sniffer),
however, I cannot figure out how to detect that it has completed. I looked in
the web and there were some old examples using:

While d2.readyState <> "complete"
DoEvents
End While
But when I tried it started using 100% of the cpu and it never ended.
Any suggestions/ideas? Also can you point me to any good tutorials that
explain how to use of mshtml and vb.net

thanks
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
ddd
Thanks Charles! This works great.

Quick question what does IPersistStreamInit do?
thanks
"Charles Law" <bl***@nowhere.com> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
I have attached a sample that I posted recently.

HTH

Charles
"ddd" <dd*@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
I am trying to use MSHTML without the webbrowser and I am having a few
problems. Right now all I am trying to do is load an URL(html page) and
access its innerhtml.

What I have is:

Dim doc As mshtml.HTMLDocument = New mshtml.HTMLDocument()
Dim d1 As mshtml.IHTMLDocument4 = doc
Dim d2 As mshtml.IHTMLDocument4 = doc
d2.write("<html><body>test</body></html>")
d2.close()
MsgBox(d2.body.innerHTML)
d2 = d1.createDocumentFromUrl("http://www.msnbc.com", "")
MsgBox(d2.readystate)

It seems like I am able to load the url correct (ran a packet sniffer),
however, I cannot figure out how to detect that it has completed. I looked in
the web and there were some old examples using:

While d2.readyState <> "complete"
DoEvents
End While
But when I tried it started using 100% of the cpu and it never ended.
Any suggestions/ideas? Also can you point me to any good tutorials that
explain how to use of mshtml and vb.net

thanks


Nov 21 '05 #2

P: n/a
As an interface it doesn't strictly *do* anything. It exposes methods for
initialising the DOM, and loading and saving a document via a stream.
Because mshtml supports so many methods, properties and events, it is a just
convenient way to group similar methods and attributes together.

HTH

Charles
"ddd" <so******@nowhereforspam.com> wrote in message
news:eg**************@TK2MSFTNGP15.phx.gbl...
Thanks Charles! This works great.

Quick question what does IPersistStreamInit do?
thanks
"Charles Law" <bl***@nowhere.com> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
I have attached a sample that I posted recently.

HTH

Charles
"ddd" <dd*@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
>I am trying to use MSHTML without the webbrowser and I am having a few
> problems. Right now all I am trying to do is load an URL(html page) and
> access its innerhtml.
>
> What I have is:
>
> Dim doc As mshtml.HTMLDocument = New mshtml.HTMLDocument()
> Dim d1 As mshtml.IHTMLDocument4 = doc
> Dim d2 As mshtml.IHTMLDocument4 = doc
> d2.write("<html><body>test</body></html>")
> d2.close()
> MsgBox(d2.body.innerHTML)
> d2 = d1.createDocumentFromUrl("http://www.msnbc.com", "")
> MsgBox(d2.readystate)
>
> It seems like I am able to load the url correct (ran a packet sniffer),
> however, I cannot figure out how to detect that it has completed. I looked > in
> the web and there were some old examples using:
>
> While d2.readyState <> "complete"
> DoEvents
> End While
> But when I tried it started using 100% of the cpu and it never ended.
>
>
> Any suggestions/ideas? Also can you point me to any good tutorials that
> explain how to use of mshtml and vb.net
>
> thanks



Nov 21 '05 #3

P: n/a
Hi Charles ,

I am fasing the similar problem. I can't see your attachment in this thread. Can you send me the coding to load the url in to HTMLDocument without using browser control.

My ID is PostBox1975@gmail.com

Thanks in advance.
May 5 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.