winform程序是否重复运行
2016-01-13 18:54
267 查看
bool ret;
System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out ret);
if (ret)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//System.Windows.Forms.Application.DoEvents();
Application.Run(new Login());
m.ReleaseMutex();
}
else
{
MessageBox.Show("程序已经在运行,不可重复运行!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out ret);
if (ret)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//System.Windows.Forms.Application.DoEvents();
Application.Run(new Login());
m.ReleaseMutex();
}
else
{
MessageBox.Show("程序已经在运行,不可重复运行!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
相关文章推荐
- MySQL limit分页查询优化写法
- 再次挖坑
- (转)android头像设置:从本地照片库或拍照获取并剪裁
- android studio gradle 打包
- 期末复习小体悟 第九章:查找 第14周导学案
- Kafka Connect
- LayoutInflater用法矫正
- 千与千寻-成长的故事
- String代码示例
- MP4文件格式简要解析
- Fragment介绍
- ffmpeg x264 x265 控制台命令显示重定向到log文件
- Android 中的 packages 间共享数据的一种方法
- Azure Storage Explorer 使用
- 创建你自己的 Java 注解类
- unbutu+mysql的root密码重置方法
- NGUI:浅谈NGUI中UISprite和UITexture
- 每天进步一点点——五分钟理解一致性哈希算法(consistent hashing)
- UIDynamic介绍
- String知识点