473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

loading a url using mshtml

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
3 5030
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BKM | last post by:
I've been using the following 2 ways to make sure my WebBrowser is finished loading a page before continuing with the next code. do:doevents:loop while WebBrowser.Busy do:doevents:loop until...
17
by: gokul | last post by:
Hi, Iam a newbie to dotnet and I experience problems in using the Browser control in VB .net. Though Iam able to use it with its basic features, I need to customise it. ...
0
by: lakshmi | last post by:
I need to load HTML string to MSHTML.HTMLDocument. I have been trying different methods but none worked. Any ideas/suggestions are welcome.
11
by: Bob Hollness | last post by:
Hi all (me again. I do try to answer the posts I can instead of just asking!!!) Any ideas how I could load a webpage into a control that was about the size of a stamp? I tried a few things but...
5
by: Atara | last post by:
I am trying to convert the following code to VB .Net, I still have some gaps (the lines that are marked with (*)) and also I need an ending condition for the while loop. any help would be...
14
by: Vibhu Bansal | last post by:
Hello, I am having certain problems in trying to use the function createDocumentFromUrl in VB.NET but get this error.."Object reference not set to an instance of object". Here is the code that I...
0
by: Atara | last post by:
Our application was build with VS 2003. I have tried to run it on a computer with .Net 2.0 (but without .Net 1.1 , as it should be used) and I got the following error - ...
11
by: Lucky | last post by:
hi guys, i need to parse html data that i've got from "Inet" object in vb6. now i want to prase the html data. here i got 2 options. one is MSXML and other is MSHTML. i tried both of them but i...
1
by: Joe | last post by:
I am trying to load some HTML code in a string variable into a mshtml.HTMLDocument object. I want to do that so I can access the various tags and structures (<table>, <a>, using VB.NET code) So...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.