Pages

Friday, January 2, 2009

Processes with C#

Something that's not of much interest to me right now. I knew about it but never found any application so I never used it.


Process graph= new Process();
graph.StartInfo.FileName = "C:\\Program
Files\\Graph\\Graph.exe";
//graph.StartInfo.Arguments = "any
arugment";
graph.Start();


Starts Graph process. With additional properties, you can set it to run in the background.


Process[] processlist = Process.GetProcesses();
foreach (Process theprocess
in processlist)
{
Console.WriteLine("Process: {0} ID: {1}",
theprocess.ProcessName, theprocess.Id);
}

This gets all the processes and displays some information about them.

See the documentation for more information. It's pretty simple and there isn't anything interesting in my opionion. Threads are bit more interesting ...

No comments:

Post a Comment