Results 1 to 12 of 12

Thread: [RESOLVED] Get HTML With Inet

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Resolved [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.
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  2. #2
    Lively Member eusty's Avatar
    Join Date
    Jan 2006
    Location
    UK
    Posts
    71

    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.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Get HTML With Inet

    I tried using the .StillExecuting but it returns False.
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  4. #4
    Addicted Member JensPeder's Avatar
    Join Date
    Sep 2005
    Posts
    249

    Re: Get HTML With Inet

    Inet seems to suck, sadly. Use the URLDownloadToFile API, winsock or make your own activex to download instead

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    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?
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  6. #6
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: Get HTML With Inet

    lets see how you have coded it.

  7. #7
    Addicted Member JensPeder's Avatar
    Join Date
    Sep 2005
    Posts
    249

    Re: Get HTML With Inet

    Quote 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.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    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:
    1. Private Sub Command1_Click()
    2. Dim HTML As String
    3. HTML = Inet.OpenURL(Text1.Text)
    4.  
    5. Debug.Print HTML
    6. End Sub
    7.  
    8. Private Sub Form_Load()
    9. Text1.Text = "http://www.azlyrics.com/lyrics/craigdavid/onelastdance.html"
    10. End Sub
    11.  
    12. Private Sub Inet_StateChanged(ByVal State As Integer)
    13. If State <> 7 Then Exit Sub
    14. Debug.Print State 'If I break here and wait 1 or 2 seconds and then resume it works fine
    15. 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.
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  9. #9
    Addicted Member JensPeder's Avatar
    Join Date
    Sep 2005
    Posts
    249

    Re: Get HTML With Inet

    VB Code:
    1. 'This project needs a button
    2. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    3. Private Sub Command1_Click()
    4.     'KPD-Team 1998
    5.     'URL: [url]http://www.allapi.net/[/url]
    6.     'E-Mail: [email][email protected][/email]
    7.     Me.Caption = "Your system will sleep 5 sec."
    8.     'Sleep for 5000 milliseconds
    9.     Sleep 5000
    10.     Me.Caption = ""
    11. End Sub
    12. Private Sub Form_Load()
    13.     Me.Caption = ""
    14.     Command1.Caption = "Sleep ..."
    15. 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

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    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!
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  11. #11
    Addicted Member JensPeder's Avatar
    Join Date
    Sep 2005
    Posts
    249

    Re: Get HTML With Inet

    Quote 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

  12. #12
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    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
  •  



Click Here to Expand Forum to Full Width