开发者

Enumerate windows on taskbar in Windows XP without P/Invoke using C#

开发者 https://www.devze.com 2023-01-22 21:31 出处:网络
Is there any method of retrieving only windows on the taskbar? I want to make a开发者_开发知识库 custom \"taskbar\" that will group APPs in any order (not just in common order like default windows ta

Is there any method of retrieving only windows on the taskbar?

I want to make a开发者_开发知识库 custom "taskbar" that will group APPs in any order (not just in common order like default windows task grouping).


You'll have to use P/Invoke. Unfortunately, there is no standard way to determine whether a window would appear in the taskbar (or in alt+tab): you can only guess.

Here's a pretty old example in VB: http://www.thescarms.com/VBasic/alttab.aspx

And in OnTopReplica, I implemented it in a similar manner. You can take a look at the source code (check out OnTopReplica/WindowSeekers/TaskWindowSeeker.cs).


Generally, without P/Invoke -- no.

However, if you only care about managed, Windows Forms windows that are within your .NET process, you can loop through Application.OpenForms and examine properties, especially Form.ShowInTaskbar. For WPF, it is Application.Windows.

0

精彩评论

暂无评论...
验证码 换一张
取 消