Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Updating my application

Posted on 2004-09-15
9
Medium Priority
?
244 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 80 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 80 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 80 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses

618 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