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.
|
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 |