Solved

Upgradable Application

Posted on 2003-11-01
9
243 Views
Last Modified: 2010-05-03
Hello.  I'm about to start a project.  I'd like it to be able to have the application check for an update and download appropiately.  I can handle the queries to a server and the downloading part, I'm just unsure how to impliment it.

Here's what I have.  

User hits "upgrade" (or app does it automatically).
App sends request to my server, or loads a simple webpage (ie www.bla.com?ver=1)
Server sends back a 0 if no updates, or the location to download the upgrade if it is out of date.
App downloads the file.
Then what?

How can an application upgrade itself while it is running?  Do I need to use DLL's?

If someone could point me in the right direction or give me an idea of how to do this, I'd be very grateful.
0
Comment
Question by:samsonite1023
9 Comments
 
LVL 2

Expert Comment

by:dmarco
ID: 9665463
Hi samsonite1023,

To open a webpage from a VB application you have to add a Wbebrowser control to your project : click on project > components and add "Microsoft Internet Controls" (shdocvw.dll) to your program.
Add also "Microsoft Internet Transfer Control 6.0 " (MSInet.ocx).

To load a webpage :

WebBrowser1.Navigate "http:\\www.bla.com"

>>Server sends back a 0 if no updates, or the location to download the upgrade if it is out of date.<<

What do you mean exactly ? Can you explain better what do you want to do.

However to load a file from your vb program :

Dim b() As Byte  ' download a file in binary format ( e.g. an .exe file, .zip, .mdb, etc.....)'
Dim strURL As String
' Imposta strURL su un indirizzo valido.
strURL = "http://www.bla.com/myfile.exe"
b() = Inet1.OpenURL(strURL, icByteArray)

Open "C:\Temp\myfile.exe" For Binary Access _ Write As #1   ' write the file on your hard disk'
Put #1, , b()
Close #1

If you want to dowload a text file or a simple text webpage :

Text1.Text = Inet1.OpenURL("http://www.bla.com")  'this code fills your text box with the html code + the text of your webpage. Then you can parse and save the text in a text file'

Text1.Text = Inet1.OpenURL("http://www.bla.com/disclaimer.txt")  'the text box is filled with your file text and you can save it '

0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 9665780
0
 
LVL 1

Author Comment

by:samsonite1023
ID: 9666517
I think you misunderstood the question.

I already know how to do all of that.  But I need to know how to upgrade the application to a newer version.

Basically, I want to know how to have a live update feature for whatever programs I make.  

I know how to check for the update and download it (if its necessary), but I *DO NOT* know what to do after that.  Nor do I know what to code in the actual update.

I hope you can understand my question.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 69

Accepted Solution

by:
Éric Moreau earned 200 total points
ID: 9666530
You need to stop the current application, update it, and restart it.

Another way that is much simpler is to have another application that looks if updates exist, and update if required before launching the so wanted application.
0
 
LVL 5

Expert Comment

by:fantasy1001
ID: 9668215
After download the new version exe, you call the setup of the new exe with shellexecute, and also exit your upgrade form/session at the same time, the installation will continue to finish.

fyi: shellexecute is an API that run another application.
   : you may need to exit current running instance of same program before installation

Regards,
~ fantasy ~
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 10163594
Points to emoreau
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now