using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ZpenSample
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//防止程序多次启动
Process[] processes = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
if (processes.Length > 1)
{
MessageBox.Show("此程序已经在运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
Thread.Sleep(1000);
Environment.Exit(1);
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormZpenSample());
}
}
}
转载
https://blog.csdn.net/qq_23062949/article/details/107657096