Using Windows API or WMI to determine if a process is displayed in the taskbar
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 informa开发者_开发问答tion I'm looking for. Am IO mistaken?
Thanks!
The rules for which top level windows appear in the taskbar are documented here. In summary:
The Shell creates a button on the taskbar whenever an application creates a window that isn't owned. To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_ APPWINDOW extended style. To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_ TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.
For more discussion take a look at Raymond Chen's article on the matter.
精彩评论