I am writing an application for any CPU. When I am running the following on a 64bit-PC it will not work:
System.Diagnostics.Process[] running = System.Diagnostics.Process.GetProcesses();
for (int i = 0; i < running.Length; i++){
try{
Console.WriteLine(running[i].MainModule.FileName);
}
catch (Exception ex){}
}
It only shows the 32bit-processes in the array running because it is running in the 32bit-mode. Is there a workaround for this?
I got the answer:
is not supported by 64-bit processes. This was the reason my code always threw an exception. So the 64bit-processes were not listed.