private static void GetSingleThread()
{         
     string name = Process.GetCurrentProcess().ProcessName;
     int id = Process.GetCurrentProcess().Id;
     Process[] nProcess = Process.GetProcesses();
     foreach(Process process in nProcess )
    {
        if ((name == process.ProcessName) && (process .Id != id))
        {     
             MessageBox.Show("对不起,本地已经有系统正在运行!\n.","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
             System.Environment.Exit(0);
         }
     }
}

相关文章:

  • 2021-05-26
  • 2021-05-20
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-12-10
  • 2021-09-23
  • 2021-12-16
猜你喜欢
  • 2021-08-15
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2021-07-16
  • 2022-01-31
相关资源
相似解决方案