Solved

Updating my application

Posted on 2004-09-15
9
233 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now