I have this program that several users on the same computer is using (windows 2008 server environment with remote desktop clients).
When the program is ended normally, it deletes a special file in its working directory. I need to be able to send all instances of this program a command to cleanly shut down (so that it deletes the file at exit).
What would be the best way to do this, and how? I assume getting the pids for each instance is a start, but then what? Anyone have any good ideas?
Edit: Forgot to mention, it's a WinForm (not a command line) program.
Edit2: My comment was too long, so I guess it's best to just edit the question instead...
The file it's deleting is actually a file containing it's pid. The reason for having this file is to make sure that the user doesn't attempt to start the program twice with the same arguments (login information).
The main program (control center) that is actually starting the client program is keeping track of the pidfile in the users directory. If it discovers the file it reads the pid and tries to see if the pid exists. If not, it actually does delete the file and is letting the user start the client window.
I guess by using that procedure, I simply could make it look for all pids asociated with my application and simply kill them, ut I'd prefere to be able to send a shutdown command, as that would also notify the user in an IM that the program is shutting down for whatever the reason given. (Client initiated, remote server initiated, or, as in this case "Local server initiated").