Solved

Updating my application

Posted on 2004-09-15
9
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

705 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