In C#, its very easy to play with processes. If you want to access currently running processes, With just two or three easy lines of code you can achieve that. You can see my article on How To Get List Of All The Running Processes In C#. If you want to close any particular process, then you can do so by using a simple code described below.
Instructions:
- Loop Through All the processes running and search for your process.
- When you find that, just kill the process and show a message.
Code:
foreach (Process p in Process.GetProcesses())
{
if (p.ProcessName == "firefox")
{
p.Kill();
MessageBox.Show("Process Firefox is Successfully Closed");
}
}
Incoming search terms:
- c# close process -start -VB -CloseMainWindow -Kill (1)
- C# Process GetProcesses descrição (1)
- code for end task at the run (1)
- lilling proveds using c# (1)