Solved

simultaneous downloading

Posted on 1998-07-07
2
146 Views
Last Modified: 2010-05-03
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
0
Comment
Question by:woodie
2 Comments
 
LVL 2

Accepted Solution

by:
Jagar earned 50 total points
ID: 1465158
change the above code to execute the first command then wait in the StateChanged Event for the Complete command (look in the help for exact constant).  Then Execute the second command.
If the two must happen at the same time then you have to use two INET controls and execute one on the first control and the other on the second control.
0
 
LVL 1

Expert Comment

by:thomas_mathiesen
ID: 4304850
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).

=)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now