using System.Diagnostics;//using namespace
Process[] ps = Process.GetProcessesByName("ipmsg");
if (ps != null)
{
//
foreach (Process p in ps)
{
MessageBox.Show(p.StartTime.ToString()); //Show the time of the process runned
p.Kill(); //kill the process
}
}
Process[] ps = Process.GetProcessesByName("ipmsg");
if (ps != null)
{
//
foreach (Process p in ps)
{
MessageBox.Show(p.StartTime.ToString()); //Show the time of the process runned
p.Kill(); //kill the process
}
}
本文介绍了一段使用C#代码来查找并终止名为ipmsg的进程的方法。通过调用System.Diagnostics命名空间下的Process类的GetProcessesByName方法获取指定名称的进程实例,然后遍历这些实例并显示每个进程的启动时间,最后强制结束这些进程。
483

被折叠的 条评论
为什么被折叠?



