static void Main(string[] args) { bool result; Mutex m = new Mutex(false, System.Reflection.Assembly.GetExecutingAssembly().FullName, out result); if (!result) { // 程序已经运行! return; } Console.WriteLine("运行..."); Console.Read(); }
static void Main(string[] args) { bool result; Mutex m = new Mutex(false, System.Reflection.Assembly.GetExecutingAssembly().FullName, out result); if (!result) { // 程序已经运行! return; } Console.WriteLine("运行..."); Console.Read(); }