Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Download file from the web using API


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

'this will download the file onto the local harddrive
Dim iReturn As Long
iReturn = URLDownloadToFile(0, " http://www.domain.com/filename.txt " , "c:\localfile.txt" , 0, 0)