Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Window Position - Mac

All of the pieces you need are there -- you just have to assemble them. :-)

windowNumbersWithOptions: is a 10.6-only API. If you want 10.5 support you need to look at NSCountWindowsForContext() and NSWindowListForContext(). 

Once you have a window number, have a look at CGWindow.h, which has a number of methods for getting information about any open window.

-- Scott K.


On Apr 21, 2010, at 4:05 AM, Jacob wrote:

> I'm pretty sure it's doable, I've seen applications on Mac that can affect windows on a global level. A quick look in the documentation for the NSWindow class I found this: http://developer.apple.com/Mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/clm/NSWindow/windowNumbersWithOptions:
> 
> I think it may be what he wants but I don't know how to get from a window number to an actual window. 
> 
> On Apr 21, 2010, at 03:54, Sky Yan wrote:
> 
>> If the "any application" means the application in other process, the answer is: no. Mac do not have global window or control handle as HWND on win32. So you can just get window information within current process but have no idea about window in other process. 
>> 
>> But there is other method to get position of window in other process, you could try Accessibility API on Mac. You may need to write c code to use it. 
>> 
>> sendmsg in cocoa is object-c method. It is totally different with SendMessage on win32. 
>> 
>> On Tue, Apr 20, 2010 at 11:06 PM, Belcher, Josh <Josh.Belcher@xxxxxxxxxx> wrote:
>> I have been searching for awhile now for a Mac equivalent of the org.eclipse.swt.internal.win32 functions  FindWindow() and GetWindowRect().  I would like to be able to launch any application, gain control of it and query it to find out where it’s top left position is.  If there is a way to do it by setting its position, that would also work for me.
>> 
>> In the org.eclipse.swt.internal.cocoa I have seen some things about sendmsg – but I haven’t been able to find any good examples of how that works in swt, or if that is even what I need.
>> 
>> 
>> _______________________________________________
>> platform-swt-dev mailing list
>> platform-swt-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>> 
>> 
>> 
>> 
>> -- 
>> 
>> 
>> Thanks,
>> 
>> Sky Yan
>> _______________________________________________
>> platform-swt-dev mailing list
>> platform-swt-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> 
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top