[英]On Windows XP, how do I enumerate all the windows displayed by the system (C#)
I would like to end up with a list (or array or whatever) of all the visible (including minimised) windows. 我想以所有可见(包括最小化)窗口的列表(或数组或其他形式)结束。
I have found 2 similar questions, which don't quite give me what I'm looking for: 我发现了2个类似的问题,这些问题并不能完全满足我的需求:
- Work out which windows go in the alt-tab list - 找出哪些窗口进入alt选项卡列表
- list windows in another user's session - 在另一个用户的会话中列出窗口
Thanks. 谢谢。
I think that the blog entry by Raymond Chen pointed to in the first link gives you an idea of where you want to go. 我认为Raymond Chen在第一个链接中指出的博客条目可以使您大致了解要去的地方。 Basically, you would call EnumWindows and then apply that algorithm, except that you would take note of every window handle that is visible. 基本上,您将调用EnumWindows,然后应用该算法,但要注意每个可见的窗口句柄。
The question is a little vague, what is the purpose here (there might be a better way given more info). 问题有点模糊,这里的目的是什么(如果有更多信息,可能会有更好的方法)。
How about this to get a list of processes that would go into the alt-tab list. 如何获得将进入alt选项卡列表的进程的列表。 (Running processes that contain a window): (运行包含窗口的进程):
using System.Diagnostics.Process;
List<Process> plist = new List<Process>();
foreach (Process p in Process.GetProcesses())
{
string title = p.MainWindowTitle;
if (!String.IsNullOrEmpty(title))
{
plist.Add(p);
}
}
只需使用EW()API(win32常见问题解答)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.