Winform判断是否已启动

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Net;

namespace Client
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]     
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (Process.GetProcessesByName("UI").Length > 0)
            {
                MessageBox.Show("请不要重复启动程序!");
            }
            else
            {
                //程序执行代码
            }
            
        }
    }
}
原文地址:https://www.cnblogs.com/wpcnblog/p/3904142.html