Closing an Application when another is found.

i need someone to help me make a program to close and applicalcation, when another is found.
Then i need it to the closing application to close when the main application is no longer opened, and it needs to be in a loop so that the first closed application can no longer be opened.
I don't think I understand. Can you try explaining it again?
As far as my experience goes, an application/process can not close another process unless both applications are synchronized. I can think of a solution using mutex events. But I am not sure if the processes you are talking about are synchronized.
Are you talking about if someone tries to start another copy of your application? For example, if myprog.exe is running, and the user tries to start another instance of myprog.exe, but you want only one copy of the program running at a time?

You'll need to use CreateMutex and you'll probably want to use RegisterWindowMessage and subclass your program's window procedure too.

If you google "application mutex" you'll get some pretty good code to do that. The first link from when I checked is in Pascal, but you can still use it as a reference.

If you need more help let us know.
Last edited on
Topic archived. No new replies allowed.