Find Window At Location Using Carbon And Carbon Problems In 64-Bit Applications

ⅰ亾dé卋堺 提交于 2019-12-11 15:39:05

问题


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


回答1:


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.)



来源:https://stackoverflow.com/questions/2628921/find-window-at-location-using-carbon-and-carbon-problems-in-64-bit-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!