bool createNew;
var mutex = new Mutex(false,"SingletonWinAppMutex",out createNew);
if(!createNew)
{
MessageBox.Show("Can only start one instance");
Application.Exit();
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form());
限制应用程序只能打开一个
最新推荐文章于 2019-12-02 21:32:08 发布