C# 用Mutex或进程限制一台电脑上同时打开多个实例

private void Form1_Load(object sender, EventArgs e)
        {
            bool requestInitialOwnership = true;

            bool mutexWasCreated;
            System.Threading.Mutex m = new System.Threading.Mutex(requestInitialOwnership, Application.ProductName, out mutexWasCreated);
            if ( !mutexWasCreated)
            {
                Application.Exit();

            }

 

}

posted @ 2013-06-24 10:29  纵一苇之所如-  阅读(1031)  评论(0编辑  收藏  举报