在program的mian方法中添加如下代码:

        static void Main()
        {
            bool started = true;
            using (new Mutex(true, Assembly.GetExecutingAssembly().FullName, out started))
            {
                if (!started)
                {
                    MessageBox.Show("程序已启动!");
                    System.Environment.Exit(0);
                }
                else
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new FrmLogin());
                }
            }
        }

 

相关文章:

  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-10-07
  • 2021-12-05
猜你喜欢
  • 2021-10-15
  • 2022-01-09
  • 2021-10-01
  • 2022-12-23
  • 2021-10-28
  • 2022-03-05
  • 2022-12-23
相关资源
相似解决方案