开发者

Get Open Windows in Objective C

How would I get the names of the open w开发者_JAVA百科indows on Mac OSX in Objective C? Basically I just want to check if a window with a specific name (ie. "Chrome" to detect if Chrome is open) is open.

The app in question will NEVER run without a window open (unlike Chrome in my example), so detecting running processes may not be necessary.


For the case you describe, looking through the window list is not a good approach. For example, Chrome does not have a window named "Chrome" AFAIK — the names of its windows depend on the currently open tab. If you want to detect an application, use NSWorkSpace's launchedApplications method.

To actually detect windows, use the Quartz Window Services API.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜