View Single Post
Old 11-04-2007, 12:29 AM   #5 (permalink)
Storm33229
Forum Expert
 
Join Date: Jul 2003
Location: Arizona
Age: 19
Posts: 3,208
Send a message via AIM to Storm33229 Send a message via Yahoo to Storm33229
Default

Quote:
Originally Posted by Joeku View Post
Process Members

Try this:
Code:
static void stopProcess()
{
    System.Console.Write("What process would you like to stop?: ");
    string pname = System.Console.ReadLine().ToUpper();
    Process[] processes = Process.GetProcessesByName(pname);
    Process process = null;

    if( pname == "NONE" )
    {
        System.Console.WriteLine("Process stopper canceled.");
        CommandHandler(commandGiven);
        return;
    }

    string temp;
    foreach (Process p in processes)
    {
        temp = p.ProcessName.ToUpper();

        //if (Convert.ToString(process).ToUpper().Contains(pname.ToUpper()))
        if( temp.IndexOf( pname ) > -1 )
        {
            process = p;
            break;
        }
    }

    if( process != null )
    {
        process.Kill();
        System.Console.WriteLine(process.ProcessName + " has been stopped.");
    }
    else
    {
        System.Console.WriteLine(pname + " is not a valid process name. Please try again.");
        stopProcess();
    }
}
Yay it works now
__________________
Quote:
Originally Posted by Radwen
You should crush your pills and sniff them.
Storm33229 is offline   Reply With Quote