Jump to content
al17nichols

best way to structure an application

Recommended Posts

I want to create an application that can check for updates and if needed download new an update before launching.   The application will contain multiple forms and some threads to monitor tidtcpclient (socket) connections.  My thought was to create a thin application what would check for version updates on a remote server.  After checking and downloading (if necessary) i could launch the application.  Should the secondary (core of the application) be a .dll or should I call the windows API that that launches a second application?

Share this post


Link to post
Guest

If i understood you question correctly, maybe this helps?

You must click on the first line in the "card" above.

Edited by Guest
Non optimal link by DP

Share this post


Link to post
21 hours ago, al17nichols said:

create an application that can check for updates and if needed download new an update before launching.

if it's an application, the easiest answer is in the first sentence..

make a launcher that checks for updates then launches main app, then exits..

 

I can also second Dave's recommendation as I've used TMS as well and it works great, no second app to maintain.

 

 

  • Like 1

Share this post


Link to post

No need for a launcher, a single .EXE can do it - at least on Windows.

Windows allows to rename the executable even if your application is running. So the steps are...

- Download the updated .exe, and save it e.g. .exe.new

- Rename the current application (Application.ExeName) to .exe.old

- Rename the updated file .exe.new -> .exe

- Launch the .exe and immediately quit

- It's a good practice to wait for the previous process to actually die before doing any actual work, like reading settings up, etc.

- Upon startup check and delete any .exe.old files

 

I'm using this method and it works like a charm.

Edited by aehimself
  • Like 6

Share this post


Link to post

Great answers.  I can appreciate the ability to rename the exe and quit, but That is not quite a smooth as a launcher.  If I used a launcher do I need to create the main as a .dll or launch it with the Windows API.  I can't remember but I used it quite some time ago.

Share this post


Link to post

i can also second ae's approach, especially if you wanted some automation.

app launches, check Application.ExeName, if it's the orig, copy orig to newname, launch newname, then exit.

now you can update orig exe as needed.

 

Launcher app approach is typically just another application that executes the other after checking for and applying updates.

Share this post


Link to post

another +1 for AE's answer. Simple and reliable. Nice option for those who wasn't seduced by Dark Side that preaches installing separate updater service

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×