static void Main()
{
Process instance = RunningInstance();
if (instance == null)
{
Application.Run(new Form1());
}

}

#region RunningInstance
private static Process RunningInstance()
{
Process current = Process.GetCurrentProcess();
Process[] processes = Process.GetProcessesByName (current.ProcessName);
if(processes.Length>1)
{
return current;
}
else
{
return null;
}
}
#endregion
评论
发表评论

提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则

您还没有登录,请登录后发表评论

心似海
搜索本博客
博客分类
最近加入圈子
存档
最新评论