简体   繁体   English

在Windows XP上,如何枚举系统显示的所有窗口(C#)

[英]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.

相关问题 使用C#枚举Windows XP中没有P / Invoke的任务栏上的窗口 - Enumerate windows on taskbar in Windows XP without P/Invoke using C# 如何从Windows XP Embedded中的C#访问性能计数器? - How do I access performance counters from C# in Windows XP Embedded? 如何在 C# 中获取 Windows XP 产品密钥? - How can I get windows XP product key in C#? 如何在C#中隐藏Windows系统托盘? - How do I hide the Windows system tray in C#? 使用c#在远程系统上枚举Windows用户组成员 - Enumerate Windows user group members on remote system using c# 我的 C# windows 应用程序在系统启动时运行。 但适用于 windows xp 而不适用于 windows 7。我已经编写了这些代码 - my C# windows application runs on system startup. but works in windows xp and not in windows 7. I have written these codes 如何使用 C# 或免费的 XP 工具卸载或删除 Windows XP Sp3 游戏? - How can I uninstall or delete Windows XP Sp3 Games using C# or free XP tools? 在Windows XP和Windows 7上如何枚举SharePoint文件夹中的文件夹和文件 - How enumerate folders and files in a SharePoint folder on Windows XP versus Windows 7 如何通过c#在Windows XP上测量Windows XP到Windows 8的上传和下载网络利用率? - how do measure upload and download Network utilization by Process on Windows XP to Windows 8 in c#? 如何使用C#查找所有窗口? - How do I find all windows using C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM