Results 1 to 4 of 4

Thread: Downloading With Internet Transfer Control

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 1999
    Posts
    25
    Hi,
    I've been trying to download binary files, mainly gifs, using the Internet Transfer Control. I am using the code that is in the Help for VB 5.0:

    Inet1.AccessType = icUseDefault
    Dim b() As Byte
    Dim strURL As String

    ' Presuming this is still a valid URL.
    strURL = "ftp://ftp.microsoft.com/" & _
    "developr/drg/Win32/Autorun.zip"

    ' Retrieve the file as a byte array.
    b() = Inet1.OpenURL(strURL, icByteArray)

    Open "C:\Temp\Autorun.zip" For Binary Access _
    Write As #1
    Put #1, , b()
    Close #1
    MsgBox "Done"

    I have changed the code to download gif files from my web site and other web sites, but about 25% of the time the gif that is downloaded is corrupted, which means the gif looks sort of like it should, but the pixels are out of place.
    Does anyone know how to fix this, or has anyone else had this problem?

    Thank you for any help you can give.

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Karjalohja, Finland
    Posts
    123
    Try this way:

    Public Sub FtpConnect()

    Inet1.AccessType = icUseDefault
    Inet1.Protocol = icFTP
    Inet1.URL = "ftp.microsoft.com"
    Inet1.UserName = "anonymous"
    Inet1.Password = "[email protected]"
    Inet1.RemotePort = 21
    Inet1.RequestTimeout = 60

    Inet1.Execute , "CD developr/drg/Win32"
    Do
    DoEvents
    Loop While Form1.Inet.StillExecuting

    FtpGetFile

    Inet1.Execute , "QUIT"
    Do
    DoEvents
    Loop While Inet1.StillExecuting

    End Sub

    Public Sub FtpGetFile()

    Dim GetFile as String
    GetFile = "AutoRun.zip"

    Inet1.Execute , "GET " & GetFile & " " & "C:\Temp\" & GetFile
    Do
    DoEvents
    Loop While Inet1.StillExecuting

    End Sub

    Hope this helps you.

    Or look here:
    http://www.vbsquare.com/internet/inet1/
    http://www.vbsquare.com/internet/inet2/
    http://www.vbsquare.com/internet/inet3/

    -Dj4

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 1999
    Posts
    25
    I'm trying to download from an http site, for example: http://slimticker.hypermart.net/prev40.gif

  4. #4
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489
    To dj4:

    Each time I tried using the ITC, I had the same problem: I get an infinite loop.

    Do
    DoEvents
    Loop While Form1.Inet.StillExecuting

    After connecting to the URL (ftp, in my case), the loop will never end. And I am 100% sure it is succesfully connected to the ftp.

    Why is this happening?!

    Chris

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