昨夜飘风
昨 夜, 风, 飘 过; 枯 树, 叶, 飞 落。
--System.Diagnostics.Process 提供对本地和远程进程的访问并使您能够启动和停止本地系统进程。

System.Diagnostics.Process[] myProcesses = System.Diagnostics.Process.GetProcesses();

foreach (System.Diagnostics.Process myProcess in myProcesses)
{
    if (myProcess.ProcessName.ToUpper() == ProcessesName)
    {
        myProcess.Kill();
        break;
    }
}

或则
System.Diagnostics.Process[] sProcesses = System.Diagnostics.Process.GetProcesses();
            for (int i = 0; i < sProcesses.Length; i++)
            {
                if (sProcesses[i].ProcessName.ToLower().Trim() == ProcessesName)//ToLower()全部小写
                {
                    sProcesses[i].Kill();
                    break;
                }
            }

posted on 2008-02-26 11:30  昨夜飘风  阅读(593)  评论(0编辑  收藏  举报