防止应用程序多次执行(在进程里只一个)

来源:互联网 发布:a标签title属性 seo 编辑:程序博客网 时间:2024/05/21 09:38
[STAThread]
  static void Main()
  {
   bool isCreate;   
   Mutex mutex=new Mutex(true,"JNR3Lead",out isCreate);
   if(isCreate)
   {
    Application.Run(new Form1());
    mutex.ReleaseMutex();
   }
  }