On instance in .NET CF

1:Add two file "MutexEx.cs" and "NativeMethod.cs" from OpenNETCF  into your solution.
 
2:Code here
static void Main()
  {
   OpenNETCF.Threading.MutexEx mutex = new OpenNETCF.Threading.MutexEx(true,"hahahaha");
   bool running = !mutex.WaitOne(0,false);
   if(!running)
    Application.Run(new Form1());
   else
    MessageBox.Show("Already running.");
  }
posted @ 2006-03-27 08:46  Liren  阅读(385)  评论(0编辑  收藏  举报