使用 Carbon 查找位置窗口以及 64 位应用程序中的 Carbon 问题
正如我今天在一些问题中所说,我正在寻找在某个位置获取窗口或 windowPart 引用的方法。虽然我知道我可以使用 Cocoa 来实现此目的(我还不知道如何做到这一点),但我更喜欢(并且可能需要)使用 Carbon 来执行此操作,因为需要此功能的整个应用程序是用 C++ 编写的,但我已经尝试了一下发现很多问题。
有人使用以下函数之一获得有效的 windowPtr 或 windowRef 吗? FindWindow、MacFindWindow、HIWindowFindAtLocation 或 FindWindowOfClass
我总是得到 0 作为我要查找的 windowRef 或 windowPtr。我做错了什么?有什么想法吗?
确实,现在如果你想为Mac OS X创建一个64位应用程序,你需要使用Cocoa来实现它的用户界面,因为Carbon应用程序常用的一些API在64位应用程序中不可用?
谢谢。
杰×××
As I said in some questions today I´m looking for the way to get window or windowPart references at a certain location. Although I know I could use Cocoa for this purpose (I don´t know how to do it yet) I prefer (and probably need) to do this using Carbon because the entire application that needs this functionality is written in C++ but I´ve found many problems trying it.
Does anyone get a valid windowPtr or windowRef using one of the following functions? FindWindow, MacFindWindow, HIWindowFindAtLocation or FindWindowOfClass
I always get 0 as the windowRef or windowPtr that I´m looking for. What I´m doing wrong? Any ideas?
It´s true that now if you want to create a 64-bit application for Mac OS X, you need to use Cocoa to implement its user interface because some APIs commonly used by Carbon applications are not available in 64-bit applications?
Thank you.
JxXx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于 您对此问题的回答 您似乎正在尝试获取另一个应用程序窗口的 WindowRef。
正如这篇发布到carbon-dev列表的文章所说:
关于 64 位 Carbon 的说法是这样的:
编辑 -
您可以使用
[NSEvent mouseLocation]
(Cocoa) 或GetMouse()
(Carbon) 获取鼠标位置。如果您想与属于另一个应用程序的窗口进行交互,则需要使用类似 辅助功能 API (Cocoa),或低级 Quartz 窗口列表函数。 Quartz 函数返回所有窗口(属于所有应用程序)的列表以及每个窗口的有限信息(边界、拥有的 PID 等)Based on your response to this question it appears that you are trying to get a WindowRef to another application's window.
As this posting to the carbon-dev list says:
And the word on 64-bit carbon is this:
EDIT -
You can get the mouse location with
[NSEvent mouseLocation]
(Cocoa) orGetMouse()
(Carbon). If you want to interact with windows belonging to another application, you'll need to use something like the Accessibility API (Cocoa), or the low-level Quartz Window list functions. The Quartz function returns a list of all windows (belonging to all applications) and limited information about each (bounds, owning PID, etc.)