How To Ideas | How To Articles | How To Tutorials


0

How To Close A Running Process Using C#


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:

  1. Loop Through All the processes running and search for your process.
  2. 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");
    }
}

Kill Process Using C#

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)
Filed in: C# Tags: , , , , , , , , , , , , , , , ,

Leave a Reply

Submit Comment



© 3634 How To Ideas. All rights reserved.
Proudly designed by Theme Junkie.