How to get a list of all open NSWindow from all running application?

萝らか妹 提交于 2019-12-28 05:35:33

问题


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


回答1:


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

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.




回答2:


You can use the accessibility API (accessibility must be enabled under System Preferences for it to work) to get information on windows (and other UI elements) from other processes. This question might be just what you're looking for.




回答3:


ALL running applications? No. You can only get the NSWindows of your own app. You may be able to use Universal Access or Core Graphics APIs to get some information about windows of other apps, but not full access.



来源:https://stackoverflow.com/questions/4036420/how-to-get-a-list-of-all-open-nswindow-from-all-running-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!