开发者

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

开发者 https://www.devze.com 2023-01-22 20:11 出处:网络
Is开发者_StackOverflow社区 there a way to get list of open or visible NSWindow from mac desktop?Note that not all windows are necessarily NSWindows, and that NSWindow only provides an interface to win

Is开发者_StackOverflow社区 there a way to get list of open or visible NSWindow from mac desktop?


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.


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.


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.

0

精彩评论

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