|
-
Jan 20th, 2006, 09:03 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Get HTML With Inet
Well I'd just completed a program that uses the Inet control to get the HTML of a webpage and then parse it. Now I've bought a new, much faster computer and the exact same program won't work properly! The problem is that the Inet is not downloading the entire html source. The thing is, if I add a breakpoint in Inet_StateChange just before it gets the html, it gets all of the html so I have a feeling this has something to do with my computer being so fast that it gets the html before all of it is there.
I simply use HTML = Inet.OpenUrl("http://url.com"), but it doesnt work.
When trying to get HTML for http://www.azlyrics.com/lyrics/craig...lastdance.html it always stops when the length Len(HTML) = 1159
Anyone have a solution to this?
Last edited by shirazamod; Jan 20th, 2006 at 09:10 AM.
-
Jan 20th, 2006, 09:57 AM
#2
Lively Member
Re: Get HTML With Inet
I had a similar problem which lintz found the answer to, maybe worth a look.
Steve
No trees were cut down or harmed in the posting of this message. A lot of electrons were, however, severely inconvenienced.
-
Jan 20th, 2006, 10:13 AM
#3
Thread Starter
Fanatic Member
Re: Get HTML With Inet
I tried using the .StillExecuting but it returns False.
-
Jan 20th, 2006, 10:20 AM
#4
Addicted Member
Re: Get HTML With Inet
Inet seems to suck, sadly. Use the URLDownloadToFile API, winsock or make your own activex to download instead
-
Jan 20th, 2006, 10:33 AM
#5
Thread Starter
Fanatic Member
Re: Get HTML With Inet
I would use URLDownloadToFile if it didn't freeze the program while it is downloading.
Is there any way to prevent this from happening?
-
Jan 20th, 2006, 10:34 AM
#6
Re: Get HTML With Inet
lets see how you have coded it.
-
Jan 20th, 2006, 10:37 AM
#7
Addicted Member
Re: Get HTML With Inet
 Originally Posted by shirazamod
I would use URLDownloadToFile if it didn't freeze the program while it is downloading.
Is there any way to prevent this from happening?
Sadly, no.
-
Jan 20th, 2006, 10:47 AM
#8
Thread Starter
Fanatic Member
Re: Get HTML With Inet
@Pino - Do you want to see my coding using Inet?
I've created a new project to check if something in my program is doing this but it isnt.
The project has 1 Inet control (Inet), a Commandbutton (Command1), and a textbox (Text1).
This is my code:
VB Code:
Private Sub Command1_Click()
Dim HTML As String
HTML = Inet.OpenURL(Text1.Text)
Debug.Print HTML
End Sub
Private Sub Form_Load()
Text1.Text = "http://www.azlyrics.com/lyrics/craigdavid/onelastdance.html"
End Sub
Private Sub Inet_StateChanged(ByVal State As Integer)
If State <> 7 Then Exit Sub
Debug.Print State 'If I break here and wait 1 or 2 seconds and then resume it works fine
End Sub
Maybe I should just code the program to wait 1 second.
What is the API call to Wait or Sleep or something?
Last edited by shirazamod; Jan 20th, 2006 at 10:50 AM.
-
Jan 20th, 2006, 11:04 AM
#9
Addicted Member
Re: Get HTML With Inet
VB Code:
'This project needs a button
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
Me.Caption = "Your system will sleep 5 sec."
'Sleep for 5000 milliseconds
Sleep 5000
Me.Caption = ""
End Sub
Private Sub Form_Load()
Me.Caption = ""
Command1.Caption = "Sleep ..."
End Sub
But I've used the Inet-control for the exact same thing (my own lyrics program) and I always seemed to get into troubles with it
-
Jan 20th, 2006, 11:13 AM
#10
Thread Starter
Fanatic Member
Re: Get HTML With Inet
Thanx for the code JensPeder, I'll try it out.
Out of interest, what does your lyrics program do? The program that this Inet is for is also for a Lyrics program of mine!
-
Jan 20th, 2006, 11:16 AM
#11
Addicted Member
Re: Get HTML With Inet
 Originally Posted by shirazamod
Thanx for the code JensPeder, I'll try it out.
Out of interest, what does your lyrics program do? The program that this Inet is for is also for a Lyrics program of mine!
www.g-lyrics.net
Made it on a boring night last november
-
Jan 20th, 2006, 01:08 PM
#12
Re: [RESOLVED] Get HTML With Inet
i've read a few things saying that theninet control has a lot of bugs, if you still cant get it working then you can use the webbrowser control,
webbrowser1.navigate "www.google.com"
do until webbrowser1.readstate = readycomplete
doevents
loop
text1.text = webbrowser1.innerhtml
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
|