I want to download a file from the internet to a directory somewhere on the local machine. The code I have tried before is this:
[VB] 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
Public Function DownloadFile(ByVal URL As String, ByVal LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Example
DownloadFile("http://www.Comuter Help Forums.com", "C:\DotNetForums\Comuter Help Forums.html")
[/VB]
This code produces NO build errors and NO runtime errors, however the file is NOT written to the directory. Could someone help me with this? Thanks.
[VB] 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
Public Function DownloadFile(ByVal URL As String, ByVal LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Example
DownloadFile("http://www.Comuter Help Forums.com", "C:\DotNetForums\Comuter Help Forums.html")
[/VB]
This code produces NO build errors and NO runtime errors, however the file is NOT written to the directory. Could someone help me with this? Thanks.