"Aaron" <ku*****@yahoo.com> writes:
I created a simple exe program in c#. I would like to run one instance of
the program at a time. if i click the exe after the program is already
opened it should NOT start a new instance of the program it should set focus
to the currently running program.
using System.Threading;
public class blah
{
public static void main(string[] args)
{
// the first instance of this program will
// create a mutex and its waitone returns
// true so, the other instances will get false
Mutex mutex = new Mutex(false, "blah");
if(mutex.WaitOne(1, false) == false)
return;
}
}
--
Lawrence "Rhymes" Oluyede
http://loluyede.blogspot.com