在.NET中杀死Word,Excel等进程
 private void KillProcess(string processName)
private void KillProcess(string processName) {
    { System.Diagnostics.Process myproc = new System.Diagnostics.Process();
        System.Diagnostics.Process myproc = new System.Diagnostics.Process(); //得到所有打开的进程
        //得到所有打开的进程     try
        try {
        { foreach (Process thisproc in Process.GetProcessesByName(processName))
            foreach (Process thisproc in Process.GetProcessesByName(processName)) {
            { if (!thisproc.CloseMainWindow())
                if (!thisproc.CloseMainWindow()) {
                { thisproc.Kill();
                    thisproc.Kill(); }
                } }
            } }
        } catch (Exception Exc)
        catch (Exception Exc) {
        { msg.Text += "杀死" + processName + "失败!";
            msg.Text += "杀死" + processName + "失败!"; }
        } }
    } 
                    
                 
    
 
         
                
            
         
 浙公网安备 33010602011771号
浙公网安备 33010602011771号