如何从所有正在运行的应用程序获取所有打开的NSWindow的列表?

问题描述:

有没有办法从mac桌面获取打开或可见的NSWindow的列表?

Is there a way to get list of open or visible NSWindow from mac desktop?

必须 NSW Windows ,并且 NSWindow 只提供您自己地址空间中的窗口的接口。

Note that not all windows are necessarily NSWindows, and that NSWindow only provides an interface to windows in your own address space.

访问每个窗口的支持方式是 CGWindow API。请查看抓取之王示例代码,了解其完成情况。

The supported way to access every window is the CGWindow API. Take a look at the Son of Grab sample code to see how it's done.