Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleUse the URLDownloadToFile API function to download a file from a URL into a file
DescriptionThis example shows how to use the URLDownloadToFile API function to download a file from a URL into a file in Visual Basic 6.
KeywordsURLDownloadToFile, download, file, Internet
CategoriesInternet, Files and Directories
 
Thanks to James Hansen.

The URLDownloadToFile API function downloads a file from the Internet to a local file quickly and easily.

 
Private Declare Function URLDownloadToFile Lib "urlmon" _
    Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
    ByVal szURL As String, ByVal szFileName As String, _
    ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Private Sub Form_Load()
    ' Download the file.
    URLDownloadToFile 0, _
        "http://www.vb-helper.com/vbhelper_425_64.gif", _
        "C:\vbhelper_425_64.gif", 0, 0

    ' Display the image.
    picBanner.Picture = _
        LoadPicture("C:\vbhelper_425_64.gif")

    ' Size to fit.
    Me.Width = picBanner.Width + 2 * picBanner.Left + _
        (Me.Width - Me.ScaleWidth)
    Me.Height = picBanner.Height + 2 * picBanner.Left + _
        (Me.Height - Me.ScaleHeight)
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated