G
Greg Merideth
This piece of code creates a fault at the attempt to get the modulename
of the process when (in server2k or xp) the code gets to the "System"
prcoess.
Process[] machineProcesses = Process.GetProcesses();
foreach(Process processid in machineProcesses)
{
Console.WriteLine("pid: "+processid.Id.ToString());
Console.WriteLine("name: "+processid.MainModule.ModuleName.ToString();
}
This works if I put the code block in a try{} and include an empty
catch{} block at the end of it.
It gets the name of every process *but* the system process. Is this
because system has no "MainModule" or simply cannot get its name?
of the process when (in server2k or xp) the code gets to the "System"
prcoess.
Process[] machineProcesses = Process.GetProcesses();
foreach(Process processid in machineProcesses)
{
Console.WriteLine("pid: "+processid.Id.ToString());
Console.WriteLine("name: "+processid.MainModule.ModuleName.ToString();
}
This works if I put the code block in a try{} and include an empty
catch{} block at the end of it.
It gets the name of every process *but* the system process. Is this
because system has no "MainModule" or simply cannot get its name?