C# 唯一进程(Mutex)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace ProcessMutex
{
    class Program
    {
        static void Main(string[] args)
        {
            string title = "唯一进程";
            Console.Title = title;
            bool ret;
            Mutex mutex = new Mutex(true,title, out   ret);
            if (!ret) return;
            Console.Read();
        }
    }
}


参考:

C# 避免程序重复启动(二次启动)

http://www.cnblogs.com/starxp/articles/1828367.html

Mutex 类

http://msdn.microsoft.com/zh-cn/library/01985e8f(v=vs.80).aspx

你可能感兴趣的:(C#基础知识,C#高级编程,抓取,█小小代码)