-
December 27th, 2007, 06:26 AM
#1
detect if already running
Hi,
I want to make my app, when i run it, if an instance is already running, to close that instance and run the app again.
What is the best solution:
to kill the process then start the program
or is there any way to do it ?
thanks
-
December 27th, 2007, 11:58 AM
#2
Re: detect if already running
You need to setup a protocol for these 2 processes to communicate.
I have found this an exhaustive essay on the approaches you can use:
http://www.flounder.com/nomultiples.htm
One of the technique involves in sending a registered message by the later invoked applicaiton to the previously invoked app and interpreting this message on both sides to do the necessary. You can customize this behavior to adapt to your needs.
-
December 27th, 2007, 02:22 PM
#3
Re: detect if already running
-
December 27th, 2007, 08:50 PM
#4
Re: detect if already running
Hi,
You can call CreateMutex to create a global mutex.
When you run it, try to open the mutex and check it's state, if it has been created, exits your app directly.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|