My game is a client/server application and it is critical that each client has the latest version of the client so that it properly communicates with the server. I want to create a way to update the game via the game.
I am fairly sure that you can't replace the exe while it is running, so my game plan is for the client to check for a new version. If it finds it, it runs a seperate program, Updater.exe, and then the client closes itself. The updater waits for the client to close, then downloads the patched version and installs it.
So what I need is a way for the client to run the Updater.exe, and a way for the Updater.exe to know when the Client has terminated. I found the following commands:
EXECUTABLE RUNNING : Return Integer=EXECUTABLE RUNNING(Executable ID)
EXECUTE EXECUTABLE : Return DWORD=EXECUTE EXECUTABLE(Filename, Commandline, Directory)
STOP EXECUTABLE : STOP EXECUTABLE Executable ID
Using this, I can execute the updater, but I still have no way for the updater to know when the client closed. EXECUTABLE RUNNING looked promising, but you need a handle which the updater won't have. I think it will take some DLL calls to accomplish this, but I am lost when it comes to external DLL calls.
Any suggestions?