问题描述
嗨伙计们
我想让所有正在运行的Windows应用程序
更具体我希望得到的应用程序显示下来在任务栏中
我可以播放和过滤我使用Process.GetProcesses()
的过程,并且几乎只显示在任务栏中运行的进程(如果在有人会建议更好的方式)
hi guys
I want to get all the running windows applications
to be more specific I want to get the applications shown down in the task bar
I could play and filter the process I got using Process.GetProcesses()
and display almost only the process running in taskbar (won't mid if someone will suggest a better way)
if (!proc_list.Contains(proc.MainModule.FileVersionInfo.ProductName) && proc.MainModule.FileVersionInfo.FileDescription != null & proc.MainModule.FileVersionInfo.FileDescription.Length > 2))
{
MessageBox.Show(proc.MainModule.FileVersionInfo.FileDescription);
}
无论我使用FileDescription,ProductName甚至是窗口名称,它们都不能提供我需要的结果,我需要的东西会显示真正的应用程序名称,而不是chrome.exe它显示谷歌chrome
所以这里是我想要得到的样本
[]
注意: 32位的东西并不重要。
先谢谢你们。
whether I use FileDescription, ProductName or even window name, they both don't give the results I need, what I need is something that will show me the real application name like instead of chrome.exe it shows google chrome
so here is a sample of what I want to get exactly
http://s21.postimg.org/wvy3pcco7/Untitled.png[^]
note: 32 bit stuff are no important.
thanks in advance guys.
推荐答案
Process[] processes = Process.GetProcesses();
foreach (Process p in processes)
{
if (!string.IsNullOrWhiteSpace(p.MainWindowTitle))
{
Console.WriteLine(p.ProcessName + ".exe");
Console.WriteLine(" " + p.MainWindowTitle);
Console.WriteLine("");
}
}
您可能需要做一些玩来完全获得任务管理器的功能 - 我怀疑它知道一些应用程序并智能地按摩显示的数据。但这应该给你一个开始。
更好的排除功能。[/ edit]
You may have to do some "playing" to get exactly what task manager does - I suspect it "knows" about some applications and intelligently massages the displayed data. But that should give you a start.
[edit]Better exclusion function.[/edit]
这篇关于如何在任务管理器中获取Windows应用程序名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!