static class Program
{
static Mutex mx;
static bool PreventReenterProcess(string ProcessMark)
{
bool IsSucess;
mx = new Mutex(true, @"Global\" + ProcessMark, out IsSucess);
if (IsSucess)
{
return false; //返回false表示进程不存在。
}
return true;
}
//应用程序的主入口点
[STAThread]
static void Main()
{
string state = ConfigurationManager.AppSettings["multiple2"].ToString();
if (PreventReenterProcess(state))
{
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new UpdateTimeForm());
}
}