Getting Window FrameRect From another launched Application

  • Is that possible ?

    How does it work for multiple document applications ?

    Thank you very much,

    Bests,

    -stan
  • On 9/18/07, Stanislas Polu <spolu...> 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
    <clarkcox3...>
  • 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 <spolu...> 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
    > <clarkcox3...>
  • 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 <spolu...> 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
    >> <clarkcox3...>

  • On 19 Sep 07, at 00:07, Dominik Pich wrote:
    > locally you could use AppleScript I think.
    > Regards,
    > Dominik

    Implementing VNC requires an extremely efficient response, which
    AppleScript can't necessarily provide.

    The politically correct answer is: "Unfortunately, that there's no
    efficient way of doing this using publicly documented APIs. File a
    bug report with Apple requesting that something be implemented."

    There are, however, some undocumented APIs that could help you with
    this. Look up CGSPrivate.h, but be aware that Apple reserves the
    right to break your program and/or make demons come out your nose if
    you use those functions.
  • On Sep 18, 2007, at 6:19 PM, 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 ?

    For a VNC type app you generally don't really want to track the
    windows themselves, you want to track the areas of the screen that
    have changed. You can do that by registering for screen update
    callbacks via Quartz Display Services. See CGRemoteOperation.h for
    API information.

    Now if you want to track only specific apps, then you might need to
    get some cooperation from those applications (either via
    Accessibility or Apple Events) but if you are just trying to reduce
    the amount of traffic you pass this should be fine.
    --
    David Duncan
    Apple DTS Quartz and Printing
    <david.duncan...>
  • 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 <spolu...> 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
    >>> <clarkcox3...>
    >>
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today