标签:str stop esb foreach new main ring try public
private void KillProcess(string processName)
{
System.Diagnostics.Process myproc = new System.Diagnostics.Process();
//得到所有打开的进程
try
{
foreach (Process thisproc in Process.GetProcessesByName(processName))
{
//找到程序进程,kill之。
if (!thisproc.CloseMainWindow())
{
thisproc.Kill();
}
}
}
catch (Exception Exc)
{
MessageBox.Show(Exc.Message);
}
}
public static void StopProcess(string processName)
{
try
{
System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcessesByName(processName);
foreach (System.Diagnostics.Process p in ps)
{
p.Kill();
}
}
catch (Exception ex)
{
throw ex;
}
}
标签:str stop esb foreach new main ring try public
原文地址:http://www.cnblogs.com/sqlfeng/p/6161156.html