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 strongm 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
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
 
The INET protocol? You mean you are using the Microsoft Internet Transfer Control? I don't mean to be pedantic but that isn't a protocol, it is a control that allows you to work with two internet protocols - and the control's GetHeader method is not supported on FTP connections (as the error message is trying to tell you), since the FTP protocol doesn't have headers (that's an HTTP protocol feature).

The control allows you to issue (a cut-down set of) FTP commands, and one of the missing commands is one to get the date that you are interested in. So you are going to have to use a different method ...
 
Easy enough to have a small "current version" file with date and/or versioning info in it that you pull down to evaluate whether to download the update package or not.

Consider Vista too.

In order to avoid subverting Vista's security features you normally install applications into protected filesystem locations (such as "Program Files"). A normal program can't write to such locations.

Instead autoupdaters are supposed to be separate processes that are run with elevation (i.e. full admin rights) after being ok'ed by the user. This would normally be done via a button or menu entry with the Vista "shield" icon on it, which tells the user "performing this operation will require elevation." Actually elevating when firing off the updater thread results in a security dialog.

All of this is meant to cut down on malware overwriting legit code as a way of getting invoked later on.

The checking and even the package download could be done without elevation, just the actual installation needs a new process. One advantage though is the app files don't have to be in use at this point: the app can terminate and let the updater restart it after installing the new version.

No more 1995-style reboots following the install.

These new requirements help discourage boorish software behavior such as putting data files into the "Program Files" folder as well, something that's been against Windows guidelines for some time now.
 
My apologies it is the control, no protocol i am using.

Is there any possible way using inet and ftp to get the size of the file to include for a progress bar? I know how to do this using http and the inet control where it gets the content length, but like the get header method, the content length produces an error when using inet and ftp?
 
This is one big thread that will be helping me out too! thanks everyone!
 
>the content length produces an error when using inet and ftp?

Again content length is something from the HTTP protocol. Ypou can't use it under FTP.

You have to use another method ...
 
strongm, i am aware that it is with the http protocol, thats why i was curious as to if there was anything similar or anyway to get the size using the ftp protocol or another method of generating the progress bar based on the file download?

Thanks for your reply though, greatly appreciated.
 
The reason I'm being obtuse is that I've already provided a solution that would address your requirements in this thread. And I'm still hoping you'll spot it ...
 
Thanks strongm for your help.
Small issue though, I get a type mismatch on the following line:
Set ftpFolder = WebBrowser1.Document.Folder

Any ideas why?
 
(and to be honest, I'd generally use the second version so that I only had to add one reference instead of two)
 
To make things easier, and to include the progress bar I've changed to HTTP instead of FTP. However, now im uncertain if the HTTP will allow me to browse a directory and download all files in that directory? I can download one file itself, but i would like to download all files in a directory with a .txt extension for example.
 
Sigh. I'm reminded of the fellow who needs to get across town, and some guy is telling him about the crosstown bus and he says he doesn't know how to ride the bus so "to make things easier" he rents a car, realizes that he doesn't know how to drive either, and asks the guy to help him find a tow truck so he can have the car towed across town while riding in the front seat of the truck rather than asking him to help him figure out how to ride the bus, and wonders why the guy isn't being particularly helpful.

rennis, suppose you give strongm's code another look. Trust me, it'll be worth your while to go to the trouble.

HTH

Bob
 
Here are some samples I used along with some samples at mvps.org, These originally came from allapi.net, but it appears to be something wrong with the site. These are one my beta server and the IP changes regularly. So download quick!
Date Check.zip

You can also take a look at this site:

BE SURE TO LOOK AT THE RELATED FILES....

Between these ~10 examples, you should be able to come up with something that will work for your needs.

Hope this helps....

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Thanks guys for your reply. I am at the point now where i can download the file I need. I was just curious if there was a way using the inet control and http to download all files in a specified directory ending with a certain extension. If its not possible, i can just download one file and put all the information i need into the one file, problem solved.

Either way, thanks everyone for your help.
 
Not sure if you can do it with the inet control.

With ftp, you simply do a DIR of the folder, and output it to a txt file or listbox...

Then loop the files, to download all of them...

One of the samples I supplied does exactly this, with slight modification... This is basically how I'm doing it.

My IP has changed...
If you need to download the samples I linked to, here is the new IP... 74.67.161.158

Good Luck...

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Thanks for your help bud. And everyone as well. However, i decided to make a .zip file with the other files i needed, download it, extract it, and it does exactly what i needed (as of right now). But again, thanks everyone for your help
 
rennis,

I don't know how big your zip file is...

But if you take a look at the multidown.zip in earlier post, this would work great for you... Nice and easy to implement... And you can set the number of download connections... Example 3 connections = Almost 3 times the download rate.

I use this on a 252mb zip file, and I was able to turn a 15 minute download into 5-8!

Check it out.....

Congrats on solving the problem!

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Code:
' 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.Set ftpFolder = myShell.NameSpace("ftp://user:password@ftp.site.com")("ftp://user:password@ftp.site.com")
    ftpFolder.CopyHere "c:\test.txt"
End Sub

Hi strongm, I'm planning to use this code by how do i change it so it's a download?
This is the best that i can think off....

Set localFolder = myShell.NameSpace("c:\download\")
Set ftpFolder = myShell.NameSpace("ftp://user:password@ftp.site.com/text.txt")
localFolder.CopyHere ftpFolder

Thanks!
 
Yep. That's basically how I do it (ignoring the oddities that I guess TGML has introduced into your post...)
 
Hey strongm. After setting up the ftp server, I could access it if i placed "ftp://username:password@website.com/Testing.txt" on the web browser. But when i try to run this command nothing happens. I don't get any errors either. And the file does not get downloaded to c:\Testing.txt

What am I doing wrong here?

Thanks!
Code:
Private Sub Command1_Click()
    Dim ftpFolder As Folder
    Dim myShell As Shell
    Dim localFolder As Folder
    Dim ashell As Shell
    Set myShell = New Shell
    Set localFolder = myShell.NameSpace("c:\")
    Set ashell = New Shell
Set ftpFolder = ashell.NameSpace("ftp://username:password@website.com/Testing.txt")
localFolder.CopyHere ftpFolder
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top