摘要: 用互斥法实现防止程序重复运行,使用内核对象Mutex可以防止同一个进程运行两次。注意:是名称相同的进程,而不是exe,因为exe程序可以改名。在Program.cs中修改首先添加using System.Threading;引用然后原内容改为下面所示static class Program { /// <summary> /// 互斥法防止程序重复运行 private static Mutex myMutex; private static bool requestInitialOwnership = true; private static bool mutexWasCreate 阅读全文
posted @ 2011-08-19 11:15 北冥子 阅读(619) 评论(0) 推荐(0) 编辑