Program.cs 893 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. namespace FrmMonitor
  6. {
  7. static class Program
  8. {
  9. /// <summary>
  10. /// 应用程序的主入口点。
  11. /// </summary>
  12. [STAThread]
  13. static void Main()
  14. {
  15. bool createNew;
  16. using (System.Threading.Mutex m = new System.Threading.Mutex(true, Application.ProductName, out createNew))
  17. {
  18. if (createNew)
  19. {
  20. Application.EnableVisualStyles();
  21. Application.SetCompatibleTextRenderingDefault(false);
  22. Application.Run(new Monitor());
  23. }
  24. else
  25. {
  26. MessageBox.Show("已启动该程序,不允许重复启动!");
  27. }
  28. }
  29. }
  30. }
  31. }