当前位置:编程学习 > C#/ASP.NET >>

C#杀死进程

private void KillProcess(string processName)
        {
            System.Diagnostics.Process myproc = new System.Diagnostics.Process();
            //得到所有打开的进程
            try
            {
                foreach (Process thisproc in Process.GetProcessesByName("WINPROJ"))
                {
                    if (!thisproc.CloseMainWindow())
                    {
                        thisproc.Kill();
                    }
                }
            }
            catch (System.Exception ex )
            {
                ScriptManager.RegisterStartupScript(this.btnUpload, GetType(), "dis", "alert(进程杀死失败);", true);
            }
        }

    
补充:软件开发 , C# ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,