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