|
-
Nov 11th, 2002, 09:53 AM
#1
Thread Starter
Frenzied Member
URLDownloadToFile API help ***RESOLVED***
I am using the URLDownloadToFile API to download a list of files. The problem I am having is that it is sometimes (like every other file) throwing an error that the filename doesn't exist(duh I am downloading it). What I need is to either be able to handle the error or to stop it from happening. Here is my code:
VB Code:
'declaration
Public 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
'code
Public Function DownloadFile(URL As String, LocalFilename As String, LocalDate As Date) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
Call SetFileDate(LocalFilename, CDate(Month(LocalDate) & "/" & Day(LocalDate) & "/" & Year(LocalDate)), Hour(LocalDate) & ":" & Minute(LocalDate) & ":" & Second(LocalDate))
End Function
'calling function
Call DownloadFile(DLLocation & sFileName, sPath & sFileName, dStamp)
Thanks in advance for any suggestions.
Last edited by seoptimizer2001; Nov 11th, 2002 at 11:14 AM.
seoptimizer2001
VB 6.0, VC++, VI, ASP, JavaScript, HTML,
Perl, XML, SQL Server 2000
If God had intended us to drink beer, He would have given us stomachs.
Please use the [code] and [vbcode] tags in your posts!
If you don't know how to use them please go HERE!

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|