using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace autuPrint { static class Program { public static Form1 f = new Form1(); /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); bool result; Mutex MyMutex = new Mutex(true, "autuPrint", out result); if (result) { Application.Run(f); } else { //程序已经启动 MessageBox.Show("自动打印程序已启动"); } } } }