Results 1 to 4 of 4

Thread: URLDownloadToFile API help ***RESOLVED***

Threaded View

  1. #1

    Thread Starter
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075

    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:
    1. 'declaration
    2. Public Declare Function URLDownloadToFile Lib "urlmon" Alias _
    3.     "URLDownloadToFileA" (ByVal pCaller As Long, _
    4.     ByVal szURL As String, _
    5.     ByVal szFileName As String, _
    6.     ByVal dwReserved As Long, _
    7.     ByVal lpfnCB As Long) As Long
    8.  
    9. 'code
    10. Public Function DownloadFile(URL As String, LocalFilename As String, LocalDate As Date) As Boolean
    11.     Dim lngRetVal As Long
    12.    
    13.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    14.     If lngRetVal = 0 Then DownloadFile = True
    15.    
    16.      Call SetFileDate(LocalFilename, CDate(Month(LocalDate) & "/" & Day(LocalDate) & "/" & Year(LocalDate)), Hour(LocalDate) & ":" & Minute(LocalDate) & ":" & Second(LocalDate))
    17. End Function
    18.  
    19. 'calling function
    20.  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
  •  



Click Here to Expand Forum to Full Width