开发者

Window list ordered by recently used

I'm t开发者_C百科rying to create a window switching application. Is there any way of getting a list of the windows of other applications, ordered by recently used?


Start with the Accessibility framework. Many of the hooks for screen readers are also useful here. Particularly look at the UIElementInspector sample and the NSAccessiblity protocol.

There's also Quartz Window services, which can easily give you a list of all the windows on screen. Unfortunately, it doesn't tie into concepts like window focus (just level), and I don't know of a way to get notifications back from it when levels change. You might do something like tap into the Quartz Event framework to capture Cmd-Tab and the like, but that's complex and fragile. There is unfortunately no good way to convert a CGWindowID into an AXUIElementRef (the post is for 10.5, but I don't know of anything that was added in 10.6 to improve this). But hopefully you can do everything you need through the Accessibility framework.


You would want to use

[NSWorkspace runningApplications]

to get you a list of all the applications running, and watch

[NSRunningApplication currentApplication]

to know when the user switches to a new application to keep up with which one is used more recently.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜