Kill Word, Excel, etc. in .NET.

xiaoxiao2021-03-06  60

The following method can be called directly

private void KillProcess (string processName) {System.Diagnostics.Process myproc = new System.Diagnostics.Process (); // get all open processes try {foreach (Process thisproc in Process.GetProcessesByName (processName)) {if (thisproc! .Closemainwindow ()) {thisproc.kill ();}}} catch (exception EXC) {msg.text = "Kill" ProcessName "Failure!"

转载请注明原文地址:https://www.9cbs.com/read-117251.html

New Post(0)