当前位置: 动力学知识库 > 问答 > 编程问答 >

c# Get All Process Exception

问题描述:

I have a method that adds each process in a Gridview as a row (Name, PID, Title, Path ...)

I have 64-bit Windows, but Visual Studio is running as 32-bit.

I've changed my project from 'Any CPU' to '64 Bit' and I've tried all the platforms, but I only get one process: vshost or when I launch the application with admin privileges I get two :

sqlwriter

winlogon

I'm so confused. What should I do to fix the problem?

Thanks for your time!

Code:

 Process[] Proc = Process.GetProcesses();

foreach(Process Pr in Proc)

{

string Name = Pr.ProcessName;

string PID = Pr.Id.ToString();

string Title = Pr.MainWindowTitle;

string Priority = "N/A";

string Path = "N/A";

try

{

Priority = Pr.PriorityClass.ToString();

Path = Pr.Modules[0].FileName;

}

catch(Exception) {

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: