Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for updates feature: Best way to go about adding 4

Status
Not open for further replies.

mastertorr

Programmer
Dec 21, 2006
36
0
0
CA
Just curious as to what would be the best way to going about adding a "check for updates" feature to an application whether its by a user clicking on "Check for updates" or the program automatically doing so. Recent research keeps pointing to an activex control or ClickOnce. any help on this matter would be greatly appreciated.

Thanks,MasterTorr
 
Not the most helpful I know but in my limited experience using ClickOnce isn't it only available for .NET applications?

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Any reply is as helpful as any. Thanks!

Which way would be the best way to go about doing this though with a vb6 app? I was thinking possibly a file on a server, if the number in that file is greater then the current version number, then download and install the new version....But how to actually go about it is a lil cloudy.
 
More good stuff from Hypetia in thread222-1096728; look into using Inet1.GetHeader("Last-Modified") with that code.
 
Click-once deployement gives you the ability to perform updates, because is is not a real setup project. It created manifest resources of the exes and dlls, and the app runs.
This though is a .NET feature.

In general, to perform updates, write a command window or other separate windows application that will do the updates. This separate is because you may need to update the exe file that is currently running. This means that the update must be done by another application.

To perform updates, check each assembly's (exe and dll) or others' files versions. If lower than the server's ones, download them.
 
With the separate exe, does anyone know of any other resources that maybe usefull in going about this correctly?
 
A simple solution that I use is for the app to check the date/time stamp on the local exe file and compare it to the master file on the server.

If it's different then it closes itself down immediately after opening a batch file. The batch file replaces the file on the workstation with the one on the server. The last thing the batch file then does is open the exe on the workstation.

It's not a particularly elegant solution, but it works for me.
 
Hello mastertorr,

I was wondering if you came across anything you liked!

Currently, I have a separate .exe file that uses ftp and an ini file.

Our updates are rarred(zipped) files, not the actual file so I cannot compare the actual file dates so this is what I did.

The ini file does not exist the first time the user runs the update.exe file. This forces an update no matter what on the first update attempt and creates the ini file. I do a DIR of the update folder, then use the date modified from the server for all files and add them to the ini file.

Later, when the user runs an update again, we have an ini file so I compare the dates in the ini file to the dates on the server, If any of the file dates have changed add them to an array of files to download. If new files are found add them to the array, plus update the ini file. Then display the files that are available.

I'm looking into other options, I kinda like the GetHeader but haven't had a chance to look into yet.

Let me know if you've choosen anything...
Or would be interested in seeing a sample of what I got.



AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
>I cannot compare the actual file dates

Just get hold of one of the many Touch utilities available for Windows, and you can change the timestamp of the rar file to match the timestamp of the update
 
I have done this using vb6, a few years back I might add.

What I did is use File System Object to compare current app version and version of app on servers update location upon start up.
If the two were different then I executed a vbscript and ended the app.
The vbscript had a messege box telling the user an update needed to be performed. User would click ok and the script would copy the new version to the users install location and then run the new version.
 
Thanks everyone for your help. I greatly appreciate it.

One thing I am curious about is how to download the new updated file(s) (if there is an update) and replace it(them) with the old one(s).
 
Do a search on Google for FTP examples for VB.

I started with this...
Scroll down to... Internet Data Transfer Library

Several different ways to update.
If you download to the same directory, you can overwrite the orginal file, you just need to be sure the file is not in use. Replace on a reboot... And many others....

Hope this helps...

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Boy, people do like to make FTP difficult ...

Here's the easy way (which I have previously illustrated, but the original thread is too long to ask you to wade through). it contains two examples, one leveraging IE, the other just using the shell. Although the examples illustrate uploading it is very easy to change that to downloading. And since a Folder has Items, and those Items have properties such as ModifyDate ... :
Code:
[blue]Option Explicit
 
' Webbrowser variant
' Requires references to Microsoft Internet Controls and
' and Microsoft Shell Controls and Automation
Private Sub Command1_Click()
    Dim ftpFolder As Folder
    
    WebBrowser1.Navigate2 "ftp://user:password@ftp.site.com"
    Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
        DoEvents
    Loop
    
    Set ftpFolder = WebBrowser1.Document.Folder
    ftpFolder.CopyHere "c:\test.txt"
End Sub
 
' Shell variant
' Requires references to Microsoft Shell Controls and Automation
Private Sub Command2_Click()
    Dim ftpFolder As Folder
    Dim myShell As Shell
    
    Set myShell = New Shell
    
    Set ftpFolder = myShell.NameSpace("ftp://user:password@ftp.site.com")
    ftpFolder.CopyHere "c:\test.txt"
End Sub[/blue]
 
Thanks again. Appreciate everyones help once again. I'll be testing this out over the next while so hopefully it'll be successful.
 
I've also been trying to implement automatic features into a system and I've managed to get the connection to the ftp and download the files in the directory to a directory on my system. However, Im not quite sure on how to check to see if the file has been modified or updated. At this point, the system just automatically downloads the files to a specified location.

I tried using the getheader("Last Modified") field, but i got the following error:
"This call is not valid for an FTP connection"

Anyone able to provide any suggestions?

Thanks Ennis
 
My apologies. I did read the above post. However, I currently have it coded using the INET protocol with vb6. I maybe mistaken but it doesn't appear that your example is coded using that protocol


rennis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top