在 OS X 上列出和查找窗口
我正在尝试使用 Carbon api 在 OS X 上做一些事情,但是我在 google 或 Apple 开发网站上找不到任何我想要的东西。
理想情况下,我想找到一个函数,可以在屏幕上的某个位置找到窗口。 好像也有类似的功能,不过一说是只查找当前进程中的窗口,一说是定位鼠标点击的目的地。
假设没有办法做到这一点,我将如何迭代屏幕上的所有窗口。 查找有关 OS X 窗口管理器如何工作的信息相当困难,因为它没有名称,并且任何谷歌搜索都无法引用操作系统 Windows。 它有嵌套窗口吗? 什么是窗口列表? 只有一个吗? 每个进程都有一个吗? 你可以创建任意多个吗? 我初步猜测 GetWindowList 就是我要找的,但是没有示例,并且文档都是模糊的“获取下一个窗口”,没有任何抽象或示例代码的解释。
如果有人可以解释我如何做到这一点,或者窗口管理器如何看待事物,或者指出我可以阅读相关内容的地方,那就太好了!
I am trying to do some stuff on OS X using the carbon api, but I can't find anything I am looking for on google or the Apple development website.
Ideally I would like to find a function that finds the window at a certain location on screen. It seems that there are similar functions, but one of them says that it only finds windows in the current process, and the other says that it is for locating the destination of mouse clicks.
Assuming that there is no way to do that, how would I go about iterating through all the windows on the screen. Finding information about how the OS X window manager works is quite difficult, because it has no name, and any google search is overpowered by referenced to the operating system Windows. Does it have nested windows? What is a window list? Is there only one? does each process have one? can you create arbitrarily many of them? I tentatively guess that GetWindowList is what I am looking for, but there is no example, and the documentation is all vague "Gets the next window", without any explaination of the abstraction or example code.
If someone could either explain how I could do this, or how the window manager sees things, or point me to somewhere I could read about it, that would be great!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您正在寻找的是 Quartz Window Services,Core Graphics 框架的一部分。 您可能希望从 CGWindowListCreate() 函数开始,获取屏幕上窗口的 ID 号列表,然后您可以使用该列表来获取有关每个单独窗口的更多信息。
I think what you're looking for is Quartz Window Services, part of the Core Graphics framework. You'll probably want to start with the CGWindowListCreate() function to get a list of ID numbers for the windows on screen, which you can then use to get further information about each individiual window.