我有一个方法可以将Gridview中的每个进程添加为一行(Name,PID,Title,Path ...)
我有64位Windows,但Visual Studio以32位运行。
我已将项目从“任何CPU”更改为“64位”并且我已经尝试了所有平台,但我只获得了一个进程:vshost
或者当我使用管理员权限启动应用程序时得到两个:
sqlwriter
winlogon
我很困惑。我该怎么做才能解决问题?
谢谢你的时间!
代码:
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) {
}