string strProcessName = System.Diagnostics.Process.GetCurrentProcess().ProcessName; //获取欲启动进程名
CommonData.VersionNumber = Application.ProductVersion; //获取版本号
//检查进程是否已经启动,已经启动则提示信息退出程序
if (System.Diagnostics.Process.GetProcessesByName(strProcessName).Length > 1)
{
MessageBox.Show("客户端已经运行!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //弹出提示框
Application.Exit(); //关闭程序
return;
}