Results 1 to 8 of 8

Thread: URLDownloadToFile

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    4

    Question

    I am using the URLDownloadToFile api function to get a file from an FTP server. Everything seems to work ok except a couple of things.
    1. Everything I download ends up in Temporary Internet Files as well as the location I specified. Then the next time I attempt the download it simply returns the cached version. How can I force the files not to be cached?

    2. Does anyone have an example of how to use the StatusCalleback part of the call to implement a progress bar for each download.

    Thanks in advance,

    Jay DeBoer

  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    I'm not sure how you could prevent it from caching...but you could delete the temporary files after the download is complete.
    Code:
    Kill "C:\Windows\Temporary Internet Files\" & FileDownloaded
    'I'm sure you have the filename stored as a string someplace so just place it in the above code.
    'If not then use this to clear the Temp Dir.
    Kill "C:\Windows\Temporary Internet Files\*.*"

    Gl,
    D!m
    Dim

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    4
    D!m,
    I thought about that but I run into a problem on Win2000 machines for sure, maybe NT4 as well. In 2000 the cache folders are user specific and therefore I don't know where to go to delete the files.. Any other ideas?

    Thanks

    Jay DeBoer

  4. #4
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    Even if the cache(s) in those OS's are user specified, there has to be some reference to them. Most likely there's a registry entry telling the system where the user specified the dir. I wish I could tell you where though. My use of the registry is very limited so far, but this could help you a little.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  5. #5
    New Member
    Join Date
    Apr 2001
    Location
    Malayisa
    Posts
    7

    Talking

    Originally posted by Kaverin
    Even if the cache(s) in those OS's are user specified, there has to be some reference to them. Most likely there's a registry entry telling the system where the user specified the dir. I wish I could tell you where though. My use of the registry is very limited so far, but this could help you a little.

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Use the following code to get the cache folder:
    Code:
    Private Declare Function SHGetSpecialFolderPath _
     Lib "shell32.dll" Alias "SHGetSpecialFolderPathA" ( _
     ByVal hwndOwner As Long, _
     ByVal lpszPath As String, _
     ByVal nFolder As Long, _
     ByVal fCreate As Long) As Long
    
    Private Const MAX_PATH As Long = 260
    Private Const CSIDL_INTERNET_CACHE As Long = &H20
    
    Public Function GetCacheFolder() As String
        Dim sPath As String
        sPath = Space$(MAX_PATH)
        SHGetSpecialFolderPath 0, sPath, CSIDL_INTERNET_CACHE, 0
        sPath = Left$(sPath, InStr(sPath, vbNullChar) - 1)
        GetCacheFolder = sPath
    End Function
    Best regards

  7. #7
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611
    Looking for a friendly intelligent chat forum? Visit the white-hart.net

  8. #8
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    You all realize this post was dug up after 6 months, right?
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

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