代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace 简单控制
{
class Program
{
static System.Threading.Mutex mutexMyapplication;
static void Main(string[] args)
{
bool createnew;
mutexMyapplication = new System.Threading.Mutex(false, "随便填啥", out createnew);
if (!createnew)
{
MessageBox.Show("程序已运行,不能重复运行。");
return;
}
Console.WriteLine("运行");
Console.ReadKey();
}
}
}
运行效果