Results 1 to 5 of 5

Thread: [RESOLVED] An Online Update?

  1. #1

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Resolved [RESOLVED] An Online Update?

    So I am constantly working on my programs, and making new versions.
    I have made an updater for my program, but I'm not to sure it is the proper way to do it.

    This is what it does:

    - Downloads and checks a "update.txt", hosted online with a version number in it
    - If the version number is higher than the current app's version number alerts the user to the update
    - When the message is clicked, the new version is downloaded
    - once download is finished, the app closes and the new installer is run

    This works very well and all, but the first part, were it downloads the txt file, for some reason windows continually use's the temp files once it has downloaded once. So when I update that txt file, its not for a day or two until windows actually downloads a new copy of the updated text file?

    This may just be the way I'm downloading the file? I'm really not sure?

    Any suggestions?
    Thanks

    REMEMBER TO RATE

  2. #2

  3. #3
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    Re: An Online Update?

    I had a similar problem and the way to resolve it is to clear the Cache before you redownload & check the new file.

    Code:
    'Declare
    Private Declare Function DeleteUrlCacheEntry Lib "Wininet.dll" Alias "DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Long
    Private Const ERROR_SUCCESS As Long = 0
    Private Const BINDF_GETNEWESTVERSION As Long = &H10
    
    'In a Sub
    Dim xPath as String
    xPath = fso.GetSpecialFolder(2) & "\update.tmp"
    
    Call DeleteUrlCacheEntry(xPath)
    getResult = URLDownloadToFile(0, getURL, xPath, BINDF_GETNEWESTVERSION, 0) = ERROR_SUCCESS
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  4. #4
    Lively Member astroanu2004's Avatar
    Join Date
    Jan 2008
    Location
    Sri Lanka
    Posts
    108

    Re: An Online Update?

    before downloading you can write a function to :
    check if theres already a txt file in the temp dir.
    and if there is delete it.

  5. #5

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Re: An Online Update?

    Thanks a whole heap guys! I didn't think that the cache could be so easy to work with!
    works great now thanks

    Rated you all

    REMEMBER TO RATE

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