现在的位置: 首页 > 综合 > 正文

比较简洁的Singleton Proces(唯一进程)程序

2011年04月11日 ⁄ 综合 ⁄ 共 437字 ⁄ 字号 评论关闭
        static void Main()
        
{
            
bool newMutexCreated = true;
            
using (new Mutex(true, Assembly.GetExecutingAssembly().FullName, out newMutexCreated)){
                
if (!newMutexCreated) //exist
                    return;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(
false);
                Application.Run(
new ServiceForm());
            }

        }

抱歉!评论已关闭.