Solved

Updating my application

Posted on 2004-09-15
9
235 Views
Last Modified: 2010-05-02
Hello,

I am close to compiling my program, and distributing it.

how can I make an update program to enhance the program later, almost like a service pack.

If I tell my program to look at a certain file each time it loads, could i enter code into that file to change the program?

This would probabley include bug fixes, different menue options, colour ect...........

Cheers
Chris
0
Comment
Question by:Rickardc
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 20 total points
ID: 12063142
See my own PAQ here: http:Q_21080409.html
I think it should help you.
0
 

Accepted Solution

by:
DextroSoft earned 20 total points
ID: 12064302

The only important thing to keep in mind while "updating" a program is that the program itself  can't be running, otherwise you won't be able to overwrite the executable as it will be locked by the operating system. There are sure ways to "override" these file-lockings but I prefer some other more simplistic solutions.

Mostly of the time I use 1 of these 2 solutions :

(Let's say we have a program called "A.exe" version 1  we want to upgrade to version 2 )

First Solution :

- I create a seperate executable, something like upgrade_A_to_version2.exe which will perform following tasks: check if "a.exe" is not running and  overwrite the old exe with the new version.

Sounds simple enough but we do have 2 problems with that approach:
-Where is a.exe located on the computer ?
-How do I distribute in an easy way all the files which will be copied by the program ?

For the first problem: I make sure that every time A.exe was runned, it wrote a key in the registry indicating the App.path of the executable. This way my upgrade_A_to_version2.exe can easely read in which directory the file is located which it must overwrite.

For the second problem : I create a self-extracting zip-file which contains all the new files required  and the update program itself. So when the user opens the zip (exe) file all the files are copied to a tempory location and the upgrade_A_to_version2.exe is launched automatically.

Second Solution :

Even if it is program A.exe which must be runned, make a good habit of referring all the icons of the programs to  "perform_some_tasks_before_running_a.exe". This program will check if there is a new version available ( e.g. trough an ftp connection or by means of an update directory, etc...) and overwrite the old exe with the new version. Once the copying is done it will launch the application and close itselfs. For the user this is all transparant...The user clicks on an icon titles "a" and it is "a.exe" which will open independently from the fact that some other programs were opended first.

If you have any question in how performing 1 of the steps above, please let me now. But they are all standard manipulations

Regards,

PS: it doesn't really matter if your program is subdivided in several dll's or not. The same logic can be applied...
 
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 12064347
I just simply use pskill from sysinternals.
If my versions don't match, I use my vb app to create a batch file and run it.
Within the batch file, I
a) kill the running vb app with pskill
b) copy the new exe down.
c) restart the app.
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 1

Author Comment

by:Rickardc
ID: 12064868
Right, so you would just install a new version of the program?

I was thinking of using a file containing machine code that my app would read.

Your idea is good. Would you know how to do my idea?

Cheers
chris
0
 

Expert Comment

by:DextroSoft
ID: 12064928
I'm always interested in new ways...but what do you mean with "machine code"  ?
0
 
LVL 1

Author Comment

by:Rickardc
ID: 12064965
Perhaps not machine code but somthing the app will recognise.

On  the app's startup it looks at a file, if it finds nothing it carries on, but if it finds something, it reads it and adds the code to the application.
I understand that you'd need a compiler to use a language but something that is allready compiled?!?

As you can guess, I'm not a very good programmer!
Thanks
Chris
0
 
LVL 32

Assisted Solution

by:Erick37
Erick37 earned 20 total points
ID: 12069035
Service Packs do not fix bugs by replacing bits of code within an exe or DLL, it replaces the entire file with the new version.

Use the version number of your application (Project Properties->[Make]->Version Number to set a version number.  Your application can read its own version by app.major, app.minor, app.revision.  This number is also viewable in explorer in Properties->[Version].

When you need to issue a service pack, the replacement file's version should be different.

Good Luck!
0
 
LVL 1

Author Comment

by:Rickardc
ID: 12582738
Sorry.....
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

831 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