string moduleName = Process.GetCurrentProcess().MainModule.ModuleName; string prcessName = System.IO.Path.GetFileNameWithoutExtension(moduleName); Process[] processes = Process.GetProcessesByName(prcessName); if (processes.Length>1) { MessageBox.Show("程序已经运行!"); Process.GetCurrentProcess().Kill(); }
时间: 2024-10-13 04:30:27