kill process in c#.NET
by name
Add namespace
using System.Diagnostics;
Copy following code in
your form1.cs file and this method call
in Form_Load method
public void GetProcess()
{
Process[] ProcessListAll = Process.GetProcesses();
//Aray for all Process
string MyProcessName1 = "Skype"; // This is for
Skype
foreach (Process
GetProcessOne in ProcessListAll)
{
if (GetProcessOne.ProcessName == MyProcessName1)
{
GetProcessOne.Kill();
string MyMSG = GetProcessOne.ProcessName + ".exe killed";
MessageBox.Show(MyMSG);
}
}
}
No comments:
Post a Comment