[STAThread]

static void Main()

{

     bool createdNew = false;

     Mutex mutex = new Mutex(true, “CSharpHowTo_SingleInstanceApp”,

                                   out createdNew);

     if (createdNew)

     {

//没有运行实例

          Application.EnableVisualStyles();

          Application.SetCompatibleTextRenderingDefault(false);

          Application.Run(new Form1());

     }

     else

     {           

MessageBox.Show(  “You can only run a single instance of this app!”);

     }

}

相关文章:

  • 2021-10-07
  • 2022-02-27
  • 2021-07-26
  • 2021-10-03
  • 2021-09-14
  • 2022-01-18
  • 2021-12-26
  • 2021-10-13
猜你喜欢
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2021-06-25
相关资源
相似解决方案