Kill Word, Excel, etc. in .NET.

xiaoxiao2021-03-06  58

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-113085.html

New Post(0)