C# Winform 禁止重复运行

 1         public BgControlForm(string[] args)
 2         {
 3             InitializeComponent();
 4             MessageBox.Show(args[0]);
 5             
 6             System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.UserAppDataPath.Replace(@"\""_"), out bOnlyOneInstance);
 7             if (!bOnlyOneInstance)
 8             {
 9                 System.Environment.Exit(0);
10                 return;
11             }
12         }
原文地址:https://www.cnblogs.com/yimu/p/2711785.html