Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB5,VB6
Expertise: Intermediate
Oct 6, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Download a file with one API call

If you have Internet Explorer 5 or later version, you can use an API call to download a file from the Internet withouth displaying any message box. The following code downloads the demo copy of our VBMaximizer VB6 add-in from our site to the C:\ directory on your hard disk:

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

' Note that this file is 2M, so you might want to try with something simpler
Dim errcode As Long
Dim url As String
Dim localFileName As String

url = "http://www.vb2themax.com/vbmaximizer/files/vbm_demo.zip"
localFileName = "c:\vbm_demo.zip"

errcode = URLDownloadToFile(0, url, localFileName, 0, 0)
If errcode = 0 Then
    MsgBox "Download ok"
    MsgBox "Error while downloading"
End If
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date