try { Process[] open_procs = Process.GetProcessesByName("WINWORD"); if (open_procs.Length > 0) { foreach (var proc in open_procs) { if (!proc.HasExited) { // Discard cached information about the process. Thread.Sleep(5000); proc.Kill(); } else { break; } } } } catch (Exception ex) { using (StreamWriter w = File.AppendText(@"C:\\Error.txt")) { w.WriteLine("Error occured on " + DateTime.Now.ToString() + "\t" + " In Process , Error Description \n " + ex.ToString()); } }
Process[] runingProcess= Process.GetProcesses(); for (inti=0; i<runingProcess.Length; i++) { // compare equivalent process by their name if(runingProcess[i].ProcessName=="mspaint") { // kill running process runingProcess[i].Kill(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)