Visual Basic Internet Routines
DoFileDownload: Download Files Using IE's Download Dialog
     
Posted:   Saturday January 08, 2000
Updated:   Monday December 26, 2011
     
Applies to:   VB4-32, VB5, VB6
Developed with:   VB6, Windows NT4
OS restrictions:   None
Author:   Brad Martinez
     
Related:   URLDownloadToFile: Fast, Simple and Transparent File Downloads
URLDownloadToFile: Fast, Simple and Transparent File Downloads Bypassing the IE Cache

DoFileDownload: Download Files Using IE's Download Dialog
DoFileDownload: Customize the IE Download Dialog

FtpFindFirstFile: Connect and Retrieve FTP File Listings

FtpFindFirstFile: Download Files via FTP with a Download Progress Callback

     
 Prerequisites
Established internet connection, Internet Explorer 4 or greater.

Some things are so easy!

While the FTP demos listed under Related Topics provide a robust means to list and download bulk files from a FTP server, there may be occasions when you want to simply download one file and provide a familiar interface to the user. This code, provided by Brad Martinez, shows how to display the IE file download dialog. The dialog takes care of all aspects of the interface, including the progress bar, animation and statistics. The code is easily integrated into any application requiring this functionality, including the VBnet FtpFindFirstFile: Connect and Retrieve FTP File Listings demo.

 

 BAS Module Code
None.

 Form Code
Toss a command button and a textbox onto a form. Add a full FTP path and filename to the textbox and add the following code:

Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Declare Function DoFileDownload Lib "shdocvw" _
    (ByVal lpszFile As String) As Long


Private Sub Command1_Click()
   
   Dim sDownload As String
   
   sDownload = StrConv(Text1.Text, vbUnicode)
   Call DoFileDownload(sDownload)
   
End Sub
 Comments

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright ©1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter