使用 Carbon 查找位置窗口以及 64 位应用程序中的 Carbon 问题

发布于 2024-08-28 11:48:31 字数 458 浏览 4 评论 0原文

正如我今天在一些问题中所说,我正在寻找在某个位置获取窗口或 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼眸里的那抹悲凉 2024-09-04 11:48:31

基于 您对此问题的回答 您似乎正在尝试获取另一个应用程序窗口的 WindowRef。

正如这篇发布到carbon-dev列表的文章所说:

您无法在其他程序中访问内存。来自另一个程序的 WindowRef
在您的程序的内存空间中将毫无意义。

关于 64 位 Carbon 的说法是这样的:

如果您想创建 64 位
Mac OS X 的应用程序,您需要
使用 Cocoa 来实现其用户
界面。

编辑 -

您可以使用 [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:

You can't access memory in other programs. A WindowRef from another program
would be meaningless in your program's memory space.

And the word on 64-bit carbon is this:

If you want to create a 64-bit
application for Mac OS X, you need to
use Cocoa to implement its user
interface.

EDIT -

You can get the mouse location with [NSEvent mouseLocation] (Cocoa) or GetMouse() (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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文