P
Patrick B
Here is the code I use to stop a user from starting multiple instances
of my application:
mutex = new Mutex(true, "MyMutex", out onlyInstance);
if (! onlyInstance) { return; }
This code works. If the user starts my program, and then tries to start
it a second time, the second instance will detect that it's not the only
instance, and it will shut down.
I'd like to improve this, though...
I'd like the second instance to somehow notify the first instance to
call a method. So if the user tries to start the application a second
time, the first instance of the application can respond with a series of
actions (like making a log entry, restoring the main form if it's
minimized, etc).
Any ideas for ways to do that?
Thanks!
-Patrick
of my application:
mutex = new Mutex(true, "MyMutex", out onlyInstance);
if (! onlyInstance) { return; }
This code works. If the user starts my program, and then tries to start
it a second time, the second instance will detect that it's not the only
instance, and it will shut down.
I'd like to improve this, though...
I'd like the second instance to somehow notify the first instance to
call a method. So if the user tries to start the application a second
time, the first instance of the application can respond with a series of
actions (like making a log entry, restoring the main form if it's
minimized, etc).
Any ideas for ways to do that?
Thanks!
-Patrick