发布:2018/7/2 22:54:38作者:管理员 来源:本站 浏览次数:1092
方法一: using System.Diagnostics; Process[] vProcesses = Process.GetProcesses(); foreach (Process vProcess in vProcesses) if (vProcess.ProcessName.Equals( "iexplore ", StringComparison.OrdinalIgnoreCase)) { MessageBox.Show( "IE已经打开 "); break; } 方法二: using System.Diagnostics; Process[] app = Process.GetProcessesByName("AMS"); if (app.Length > 0) { MessageBox.Show("请关闭已经启动的程序后再进行尝试"); return; } else { System.Diagnostics.Process.Start("AMS.exe"); } 杀死进程:查找到对应的进程后就可以调用系统命令杀死指定名称的进程 Process[] p = Process.GetProcessesByName("AMS"); foreach (Process ps in p) { ps.Kill(); }
© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4