How to get another application window's title, position and size in Mac OS without Accessibility API?

后端 未结 2 1688
自闭症患者
自闭症患者 2020-12-05 06:03

How can I get window\'s title, position and size if it does not support Accessibility API? Accessibility Inspector does not see it at all. Say, it\'s a xterm window in X11.a

相关标签:
2条回答
  • 2020-12-05 06:31

    You should be able to get all of this window information through the methods exposed in the CGWindow.h header file. Apple's docs are online on the Quartz Window Services Reference page. They also have a very informative sample app called Son of Grab which should get you started.

    0 讨论(0)
  • 2020-12-05 06:45

    You can use CGWindowListCreateDescriptionFromArray(). See CGWindow.h

    This gives you an array of dictionaries. The following information will probably be useful to you:

    • position and size: kCGWindowBounds
    • name: kCGWindowName
    0 讨论(0)
提交回复
热议问题