首页 > 系统服务 > 详细

使用进程名禁止程序运行多次

时间:2015-05-31 01:15:31      阅读:183      评论:0      收藏:0      [点我收藏+]
string moduleName = Process.GetCurrentProcess().MainModule.ModuleName;
string prcessName = System.IO.Path.GetFileNameWithoutExtension(moduleName);
Process[] processes = Process.GetProcessesByName(prcessName);
if (processes.Length>1)
{
    MessageBox.Show("程序已经运行!");
    Process.GetCurrentProcess().Kill();
}

使用进程名禁止程序运行多次

原文:http://www.cnblogs.com/xinzheng/p/4541310.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!