1.5.1. fejezet, Process kezelés

Process lista

namespace MultithreadedProcesses
{
    class Program
    {
        static void Main(string[] args)
        {
            Process[] processList = Process.GetProcesses(".");
            foreach (Process process in processList)
            {
                try
                {
                    Console.WriteLine("A folyamat ({0}) szálai", process.ProcessName);
                    ProcessThreadCollection ptc = process.Threads;
                    foreach (ProcessThread thread in ptc)
                    {
                        Console.WriteLine("Id: {0}, Állapot: {1}", thread.Id, thread.ThreadState);
                    }
                }
                catch(Exception ex)
                {
 
                }
            }
            Console.ReadKey();
        }
    }
}

Process indítás és leállítás

            Process explorer = Process.Start("iexplore.exe");
            Thread.Sleep(5000);
            explorer.Kill();