|
-
Nov 26th, 2000, 11:20 AM
#1
Thread Starter
New Member
I used succesfully the OpenUrl command and the related Inet object, but am facing now two problems with some URL's, of type likely never encountered before.
1) - Pages including external links (this is my personal assumption,supported only by the considered cases) block the download after few lines of Html code. The remaining data are lost.
2) Other (larg size) pages:
2a) Only 32 Kb are downloaded using the command: Text1.Text=Inet1.OpenUrl("....Url....",icString)
The remaining bytes are Lost. Even the addition of the GetChunk loop, proposed in this forum, does not help to download one additional byte.
The 32 Kb limit is extended to 64 using a string instead of The TextBox Text:
MyString=Inet1.OpenUrl ("....Url....",icString)
Adding the getCunk loop VB hangs up (Ctrl-Alt-Esc to close the application).
Note: MyString was not declared as Fixed Length string (type of data with 64 Kb capacity limit).
Can somebody help me to understand if and how these problems can be solved?
Thanks for your attention.
[Edited by gianfmal on 11-27-2000 at 05:35 PM]
-
Nov 26th, 2000, 02:44 PM
#2
The Inet Control is very buggy. If you stick to it, try this:
Code:
Text1.Text = Inet1.OpenURL("http://forums.vb-world.net", icString)
ReturnStr = Inet1.GetChunk(2048, icString)
Do While Len(ReturnStr) <> 0
DoEvents
Text1.Text = Text1.Text & ReturnStr
ReturnStr = Inet1.GetChunk(2048, icString)
Loop
Or you can go to API and use the URLDownloadToFile api function to download the web page you wish. Works good, but is a bit slow.
-
Nov 27th, 2000, 05:36 PM
#3
Thread Starter
New Member
I tested the two solutions suggested by Matthew
Only the API tip was effective.
The solution is excellent, easy and fast!
Thanks a lot Matthew!
[Edited by gianfmal on 11-29-2000 at 02:56 PM]
-
Nov 28th, 2000, 02:31 AM
#4
PowerPoster
First 2K data only
Hi! Matthew, I think your method will only able to get the first 2K data from the specific URL. Hence you may need to loop the Inet.GetChunk return string...
Code:
RichTextBox1.Text = Inet1.OpenURL("http://forums.vb-world.net", icString)
ReturnStr = Inet1.GetChunk(2048, icString)
Do While Len(ReturnStr) <> 0
DoEvents
Text1.Text = Text1.Text & ReturnStr
ReturnStr = Inet1.GetChunk(2048, icString)
Loop
-
Nov 28th, 2000, 02:34 AM
#5
PowerPoster
First 2K data only
Hi! Matthew, I think your method will only able to get the first 2K data from the specific URL. If the html file is greater than 2K then you may get in trouble too. So you definately need to loop the Inet.GetChunk return string till it return nothing.
Or you can use the URLDownloadToFile API function, but this little API will no status being return and all you need is to check with the process list before you notified the use that the file is completed save to your local hard drive.
Code:
RichTextBox1.Text = Inet1.OpenURL("http://forums.vb-world.net", icString)
ReturnStr = Inet1.GetChunk(2048, icString)
Do While Len(ReturnStr) <> 0
DoEvents
Text1.Text = Text1.Text & ReturnStr
ReturnStr = Inet1.GetChunk(2048, icString)
Loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|