"Bishman" <jo*************@btinternet.com> wrote in message
news:e2**************@TK2MSFTNGP04.phx.gbl...
I am sure this question has been asked many times before but can someone
suggest a method of stopping two instances of a C# app running at the same
time ?
You can create named Mutex object in the app instance and then check with
other instances of the program if that mutex is created. If there is no
mutex - then the application is the first, otherwise it is other instance
( 2-nd ).
Preferably I would like an attempt to invoke a second instance to bring
the first instance to the top.
After second instance got knew that there is already an instance of the app
running it can search for its window ( maybe via win32 FindWindow(...) ),
bring that window to front and then finish execution.
--
Regards, Vadym Stetsyak
www:
http://vadmyst.blogspot.com