//Kill process using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace IndiLogix.ProcKiller { class IProcKiller { public void I_KillByName(string ProcName) { try { Process[] processByName = Process.GetProcessesByName(ProcName); //Process pogo = Process.GetProcesses(); foreach (Process pr in processByName) { pr.Kill(); } } catch { Console.WriteLine("Cannot terminate " + ProcName + "\n"); } } public void I_KillByWinName(string WindowName) { //bool res; try { Process[] pro = Process.GetProcesses(); foreach (Process p in pro) { if (p.MainWindowTitle.Equals(WindowName)) { //res = true; p.Kill(); //return true; //break; } else { //res = false; //return false; //break; } } } catch { System.Windows.Forms.MessageBox.Show("Cannot terminate " + WindowName + "\n Process Not found", "Erraor:"); } //return true; } } }