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         }
posted @ 2012-10-04 21:55  易木  阅读(281)  评论(0编辑  收藏  举报