当前位置: 移动技术网 > IT编程>开发语言>.net > Keep Windows Forms Singleton via Mutex key word

Keep Windows Forms Singleton via Mutex key word

2020年03月17日  | 移动技术网IT编程  | 我要评论

恋爱季节粤语版,媒体集结号,滦县贴吧

using system;
using system.collections.generic;
using system.linq;
using system.threading;
using system.threading.tasks;
using system.windows.forms;

namespace windowsformsapplication3
{
    static class program
    {
        /// <summary>
        /// the main entry point for the application.
        /// </summary>
        [stathread]
        static void main()
        {
            application.enablevisualstyles();
            application.setcompatibletextrenderingdefault(false);
            const string appname = "windowsformsapplication3";
            bool creatednew;
            mutex mut = new mutex(true, appname, out creatednew);
            if (!creatednew)
            {
                messagebox.show($"windowsformsapplication3 is already running!", "multiple instances");
                return;
            }
            application.run(new form1());
        }
    }
}
b

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网