Hi
I want to create a c# program where i have to check processes which are currently running and close a particular of them can any one help me
Thanks.

Recommended Answers

All 3 Replies

using System.IO;
using System.Diagnostics;
//name is the process name passed to the funciton
//public bool isProcRunning(String name)
public void isProcRunning(String name)

        {

            foreach (Process clsProcess in Process.GetProcesses())

            {

                if (clsProcess.ProcessName.Contains(name))

                {//return true;
 clsProcess.CloseMainWindow();
                }

            }
// return false;

        }

Thanks both of that really helped me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.