C#判断程序是否在运行

            //获取欲启动进程名
            string strProcessName;

            strProcessName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
           
            //检查进程是否已经启动,已经启动则退出程序。
            if (System.Diagnostics.Process.GetProcessesByName(strProcessName).Length > 1)
            {
                Application.Exit();
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);           
            Application.Run(new  frmMainPlatform());

原文地址:https://www.cnblogs.com/zhangsongshan/p/2352465.html