Results 1 to 4 of 4

Thread: Downloading from internet

  1. #1
    Guest

    Arrow

    How do i download a file from the internet?
    What i want to do is to make a program to download 'Free program of the day' from my site which i am thinking to create later.

  2. #2
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    Use the Inet Control (MSINET.OCX)

    Code:
    Private Sub DownloadFile(ByVal URL as String, ByVal LocalFile as String)
        Dim b() as Byte
        Open LocalFile for Binary As #1
        b() = Inet1.OpenURL(URL, icByteArray)
        Put #1, , b()
        Close #1
    End Sub
    
    Private Sub cmdGetUpdate_Click()
        DownloadFile "http://free.digitalriver.com/pub/strata3/strata3d.zip", "C:\strata3d.zip"
    End Sub
    This will downlaod a pretty cool program. enjoy

    r0ach™
    Don't forget to rate the post

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    If you don't need that much costumization but a reliable method I suggest using the API.
    http://www.vb-world.net/internet/tip501.html

    and if you need a dialog (with the progress/speed and stuff, just the general download-dialog used in IE

    Code:
    '[begin of code]
    'Author: Brad Martinez
    'Origin: http://www.mvps.org/vbnet/code/netwo...ledownload.htm
    'Purpose: Download a file via the file-download dialog
    'Version: VB5+
    
    Option Explicit
    
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Copyright ©1996-2000 VBnet, Randy Birch, All Rights Reserved.
    ' Some pages may also contain other copyrights by the author.
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' You are free to use this code within your own applications,
    ' but you are expressly forbidden from selling or otherwise
    ' distributing this source code without prior written consent.
    ' This includes both posting free demo projects made from this
    ' code as well as reproducing the code in text or html format.
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    Private Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long
    
    
    Private Sub DownloadFile(Url As String)
       
       Url = StrConv(Url, vbUnicode)
       Call DoFileDownload(Url)
       
    End Sub
    
    '[end of code]
    Have fun!!!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Guest

    Smile

    Thank you both. That was a great help.

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