Download Updates for Program

Aug 12, 2011 at 3:32am
Hi, I'd like to have my program update itself when the user sends the appropriate command. I'm not really sure where to start, but I have a domain with a definite static ip and can upload files to it at ease.

Thanks in advance.
Aug 12, 2011 at 5:19am
You'll probably have to write a web service that checks for newer versions of the given program (the program would send its version to the web service). The program could then run a silent downloader that pulls in the new version of the program (and somehow overwrites its folder or its manifest?) Having the data on your web server and writing the web service is the easy part, I would think. The trickier part would be to update the program's exe because that's the program sending the request.

Of course, there is always third-party solutions if this is too much of a pain.
Last edited on Aug 12, 2011 at 5:24am
Aug 12, 2011 at 7:10am
Thanks for the response. Yea, that sounds like a plan, I think.

For the issue with the overriding the exe thing, maybe I could include an updater (obviously a separate exe) with the program, and when it needs to update, it'll launch the updater and close itself. The updater could then re-open the program when the update finishes. Or, well, this is what I thought of, anyway.
Aug 13, 2011 at 3:33am
I don't know what language you'll be programming these in, or what OSs you'll be supporting, but the whole "close the program, update, and re-open" is an OS-dependent task, so be prepared to have multiple implementations for that, if need be. Definitely, the actual update task will take some creativity. I haven't looked into this to be honest, but I have always wondered how actual patchers do their job in practice. The update process could be as simple as simply downloading the whole program, its folder et al., and naming the folder something unique. Then, renaming the folder and deleting the previous one. Obviously, it would require administrative privileges if run on Windows Vista/7.
Last edited on Aug 13, 2011 at 3:35am
Aug 13, 2011 at 5:27am
Well I thought the first bit would be obvious. This IS cplusplus.com after all. I was thinking mainly of Windows, so I don't think I need worry about that sort of thing. About the privileges thing, that would only apply if it existed in a write-protected folder such as Program Files or Windows.
Aug 13, 2011 at 6:15am
This IS cplusplus.com after all

Well, I have seen questions on this site about C++ CLI/.Net, C#, and even VB. I assumed the program would be installed in Program Files. Good luck with your updater!
Aug 13, 2011 at 6:16am
Thanks!
Topic archived. No new replies allowed.