使用 Windows API 或 WMI 确定进程是否显示在任务栏中
所以,我正在编写一个类似停靠栏/任务栏的应用程序。我想做的很简单,显示正在运行的程序列表。
我找到了很多方法来枚举所有正在运行的进程,但是经过几个小时的谷歌搜索,我找不到一种方法来确定哪些进程应该显示在任务栏中。
以 Windows 任务管理器为例。它有两个选项卡,一个标题为“应用程序”,另一个标题为“进程”。进程包含所有系统进程,而程序以某种方式获取计算机上运行的“应用程序”列表。我希望能够访问程序中的应用程序列表,而不是进程列表,以便在我的伪任务栏中我不会显示诸如taskhost.exe、winlogon.exe等之类的内容。
理想情况下,我会是能够获取任务栏中显示的程序的确切列表。我的程序是用 Python 编写的,并且我有 Windows API 和 WMI 访问权限,但如果我必须为 C 函数编写 python 包装器,我会这样做。
据我所知,Windows 任务栏 API 更多的是用于执行诸如向现有图标添加菜单或进度条之类的操作,我找不到访问我正在查找的信息的方法。 IO是不是搞错了?
谢谢!
So, I'm writing a dock/taskbar like application. What I want to do is pretty simple, display a list of running programs.
I've found lots of ways to enumerate all running processes, but after hours of google searching, I can't find a way to determine which of those should be displayed in a taskbar.
Take for example the Windows Task Manager. It has two tabs, one entitled Applicationss, and one entitled processes. Processes contains all of the system processes, whereas programs somehow gets a list of "applications" running on the computer. I want to be able to access the list of applications in my program, rather than the list of processes, so that in my pseudo-taksbar I'm not displaying things like taskhost.exe, winlogon.exe, etc.
Ideally I would be able to get the exact list of programs displayed in the taskbar. My program is in Python, and I have Windows API and WMI access, but if I have to write python wrappers for C functions I will do so.
As far as I can tell, the Windows Tasksbar API is more for doing things like adding menups or progress bars to existing icons, I couldn't find ways to access the information I'm looking for. Am IO mistaken?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
顶级窗口在任务栏中显示的规则已记录在
有关更多讨论,请查看 Raymond Chen 的文章 关于此事。
The rules for which top level windows appear in the taskbar are documented here. In summary:
For more discussion take a look at Raymond Chen's article on the matter.