【c# Winform 】如果程序报错后自动退出程序,关闭进程
在做一个客户端软件,加入一台电脑不能同时打开运行软件
bool isAppRunning = false; System.Threading.Mutex mutex = new System.Threading.Mutex( true, System.Diagnostics.Process.GetCurrentProcess().ProcessName, out isAppRunning); if (!isAppRunning) { MessageBox.Show("本程序已经在运行了,请不要重复运行!"); Environment.Exit(1); }