Link to home
Start Free TrialLog in
Avatar of woodie
woodieFlag for United States of America

asked on

simultaneous downloading

I'm trying to retrieve 2 files off the web at 1 time using the "execute" method in the Internet Transfer Control, but everytime it says it's..."still executing last request..".  I want it to happen right when I open a form automatically, but can't seem to figure out how to make it wait for the 1st
file request (URL) and then proceed to the next URL.  These 2 pictures are separate on the form.

Here's what I've got:
----------------------------------------------------------

Private Sub Form_Load()
    Dim strURL1 as String
    Dim strURL2 as String
    strURL1 = "http://............/pic1.gif"
    strURL2 = "http://............/pic2.gif"
    Inet1.Execute strURL1, "GET"
    Inet1.Execute strURL2, "GET"
End Sub
----------------------------------------------------------

Private Sub Inet1_StateChanged(ByVal State As Integer)
    Dim image() as byte
    Dim intfile as integer

    intfile = Freefile()

    Case 12:
        image() = Inet1.GetChunk(25000, icByteArray)
        Open "C:\temp\pic1.gif" For Binary Access Write As #intfile
        Put #intfile, , image()
        Close #intfile
        Image1.Picture = LoadPicture("c:\temp\pic1.gif")

        image() = Inet1.GetChunk(25000, icByteArray)
        Open "C:\temp\pic2.gif" For Binary Access Write As #intfile
        Put #intfile, , image()
        Close #intfile
        Image2.Picture = LoadPicture("c:\temp\pic2.gif")

End Sub
----------------------------------------------------------

Of course...the above doesn't work...  :)

Appreciate any help!
Thanks,
Fred
ASKER CERTIFIED SOLUTION
Avatar of Jagar
Jagar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thomas_mathiesen
thomas_mathiesen

Sir, you cannot use "GET" method if it is a website. You must use the openurl and save the file as binary (see msdn for example).

=)