Support Forums

Full Version: Kill A Process [C#]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Code:
{
                                    Process[] processes = Process.GetProcessesByName(TextBox1.Text);
                                    foreach (Process process in processes)
                                    {
                                        process.Kill();
                                    }
                                    Function.WriteTo(chan, "Killed Process " + TextBox1.Text + ".exe" + " !");
                                }

this could be usefull code. to reduce cpu usage to kill useless process.

anti virus.

etc.

usefull Victoire
Thanks for sharing. Useful bit of code.
Thanks again mate.
Thank you for sharing this, that is a useful code. I needed it badly, so this helped me alot!
Does this kill it for ever or just for until you shut off your computer?
it only kills it until you shut ur comp of but if you turn just that code into a program then add a code to make run on start up could work? correct me if I'm wrong
(08-29-2010, 07:20 AM)Marda Wrote: [ -> ]it only kills it until you shut ur comp of but if you turn just that code into a program then add a code to make run on start up could work? correct me if I'm wrong

So it would mainly used for anti viruses which say u cant do this correct?
yer practically

Felt like i should out something more Tongue
Thanks a lot, this could be useful for many things.
I use this quite a bit, although you should trim your code down a bit; it's got a couple of useless lines in it (People won't understand what your Function.WriteTo method is) Also the random { at the start ;)
Code:
Process[] processes = Process.GetProcessesByName(TextBox1.Text);
foreach (Process process in processes)
{
       process.Kill();
}
Pages: 1 2