C# 禁止程序重复运行,C#禁止程序多次运行
作者:笨笨 日期:2009-10-29
添加引用:
using System.Threading;
在Form_Load增加以下代码
程序代码
完成!
using System.Threading;
在Form_Load增加以下代码
程序代码 bool canCreateNew;
Mutex m_ServerMute = new Mutex(true, "EMTASS_SERVER", out canCreateNew);
if(!canCreateNew)
{
MessageBox.Show("程序已经运行,请不要重复打开!","错误提示");
this.Dispose();
}
Mutex m_ServerMute = new Mutex(true, "EMTASS_SERVER", out canCreateNew);
if(!canCreateNew)
{
MessageBox.Show("程序已经运行,请不要重复打开!","错误提示");
this.Dispose();
}
完成!
评论: 0 | 引用: 0 | 查看次数: -
发表评论

上一篇
下一篇

文章来自:
Tags: