• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting Window FrameRect From another launched Application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Window FrameRect From another launched Application


  • Subject: Re: Getting Window FrameRect From another launched Application
  • From: Mike Paquette <email@hidden>
  • Date: Fri, 26 Oct 2007 17:49:11 -0700

On Mac OS X 10.5 you can read back information on other windows within the same GUI session as the calling process using the CGWindow API (defined in /System/Library/Frameworks/ApplicationServices.framework/ Frameworks/CoreGraphics.framework/Headers/CGWindow.h).

/* CGWindowListCopyWindowInfo
* Copy the CFArray of CFDictionaries, with each dictionary containing descriptive information
* on a window within the user session.
* Returns NULL if called from outside of a GUI security session, or if no window server is running
* The returned CFArray may be empty if no windows meet the specified criteria. */


CG_EXTERN CFArrayRef CGWindowListCopyWindowInfo( CGWindowListOption option, CGWindowID relativeToWindow );

Each dictionary in the returned array will include a number of interesting values. Bounds for each window can be extracted from a dictionary in the returned array using:

CGRect boundsForWindowDictionary( CFDictionaryRef windowDictionary )
{
CFDictionaryRef rectDictionary;
CGRect rect;
rectDictionary = CFDictionaryGetValue(windowDictionary, kCGWindowBounds);
if ( rectDictionary )
{
if ( CGRectMakeWithDictionaryRepresentation(rectDictionary, &rect) )
return rect;
}
return CGRectNull; /* Failure case */
}


On Sep 19, 2007, at 12:07 AM, Dominik Pich wrote:

locally you could use AppleScript I think.
Regards,
Dominik

On 19.09.2007, at 03:19, Stanislas Polu wrote:

Actually it would be to design some kind of "window-sensitive" VNC server/client. Therefore I need to be able to track the window rectangles of third-party apps. Does it helps ?

Bests,

-stan

--
Stanislas Polu


On Sep 18, 2007, at 4:32 PM, Clark Cox wrote:

On 9/18/07, Stanislas Polu <email@hidden> wrote:
Is that possible ?

How does it work for multiple document applications ?

In the general case, I am not sure that this is possible. You may be
able to get something working by using the Accessability APIs. Post
what it is that you're actually trying to do (i.e. *why* you want to
know the locations of other application's windows) and perhaps you'll
get a more helpful response.



-- Clark S. Cox III email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Interface Builder 3 -- Completely New!
  • Next by Date: Re: Screenshot of another app's Window
  • Previous by thread: Re: Interface Builder 3 -- Completely New!
  • Next by thread: Re: Screenshot of another app's Window
  • Index(es):
    • Date
    • Thread