c# 关闭进程
2009-04-16 08:18
176 查看
//关闭进程
public void KillProcess(string processName)
{
System.Diagnostics.Process myproc = new System.Diagnostics.Process();
//得到所有打开的进程
try
{
foreach (Process thisproc in Process.GetProcessesByName(processName))
{
if (!thisproc.CloseMainWindow())
{
if (thisproc != null)
thisproc.Kill();
}
}
}
catch (Exception Exc)
{
throw Exc;
// msg.Text+= "杀死" + processName + "失败!";
}
}
public void KillProcess(string processName)
{
System.Diagnostics.Process myproc = new System.Diagnostics.Process();
//得到所有打开的进程
try
{
foreach (Process thisproc in Process.GetProcessesByName(processName))
{
if (!thisproc.CloseMainWindow())
{
if (thisproc != null)
thisproc.Kill();
}
}
}
catch (Exception Exc)
{
throw Exc;
// msg.Text+= "杀死" + processName + "失败!";
}
}
相关文章推荐
- c# 关闭进程
- C# 关闭开启进程
- C# 根据进程名关闭进程方法
- C#杀死手动关闭控制台程序,遗留的进程
- C# 使用Thread多线程,窗体关闭后进程不退出的解决方案
- c# 关闭其他程序窗口/进程
- C#关闭当前excel进程方法
- C#操作完EXCEL如何砌底关闭进程
- [转]C# 关闭嵌在程序中的word进程而不关闭用户通过word手动打开的word进程
- c#关闭系统进程以及如何调用cmd并执行命令
- C#打开或关闭windows进程
- C# 关闭其他程序窗口、进程
- 关闭(杀死)这个名字的所有进程C#
- C# 最基本的涉及模式(单例模式) C#种死锁:事务(进程 ID 112)与另一个进程被死锁在 锁 | 通信缓冲区 资源上,并且已被选作死锁牺牲品。请重新运行该事务,解决方案: C#关闭应用程序时如何关闭子线程 C#中 ThreadStart和ParameterizedThreadStart区别
- C# 关闭 Excel进程
- c# 启动关闭进程
- c# 强制关闭进程
- c# 启动关闭进程
- C# 关闭进程
- 【C#学习笔记】检测进程是否存在并关闭