Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / September 2008



Tip: Looking for answers? Try searching our database.

NSWindow pointer to another app's window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sean Setter - 27 Jul 2008 00:49 GMT
Is it possible to get an NSWindow pointer to another application's
windows?

I am working on an assistive app where I want my application to
overlay some additional information over the window(s) of another
application.  For all intensive purposes, I want the information that
I am displaying to appear as if it were actually part of the target
window (i.e. moves with the target window as the target window moves
around the desktop, correctly handle window layering, etc.)

NSWindow has the addChildWindow:ordered: method, which would be
fantastic if I could use this to add a transparent overlay to the
target window, but I would need a pointer to the target window.

Much thanks for all the help.
Gregory Weston - 27 Jul 2008 01:22 GMT
In article
<d849c7b8-49d9-4f36-90e8-b13316a30bfe@p25g2000hsf.googlegroups.com>,

> Is it possible to get an NSWindow pointer to another application's
> windows?

No. Pointers are only valid within the address space of the owning
application, and one app's address space does not overlap another's.

> I am working on an assistive app where I want my application to
> overlay some additional information over the window(s) of another
> application.  For all intensive purposes,

Gah.

That's "intents and purposes."

> I want the information that
> I am displaying to appear as if it were actually part of the target
[quoted text clipped - 6 lines]
>
> Much thanks for all the help.

If you're creating an assistive app, you should use the API provided to
allow assistive apps to work. Start with AXAPIEnabled() and
AXUIElementCreateApplication(). Unfortunately, the obvious solution -
relying on kAXWindowMovedNotification - won't handle continuous tracking.

Signature

"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
  - Harry Potter and the Odor of the Phoenix

Sean Setter - 27 Jul 2008 05:38 GMT
That is the path I have been going down but it seems it will be quite
kludgy by the time it is all put together.  Since the callback
functions exist within their own thread it feels like I am adding
additional layers of complexity that might not have been needed in the
first place.

As for intent, I am only providing decision support information for a
particular online game.  Software serving the same purpose has existed
on Windows for several years now, and is widely accepted within the
community.  As a matter of fact, it might be the only reason I still
boot up a Windows machine.

In any case, I appreciate your response.

> In article
> <d849c7b8-49d9-4f36-90e8-b13316a30...@p25g2000hsf.googlegroups.com>,
[quoted text clipped - 32 lines]
> "Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
>    - Harry Potter and the Odor of the Phoenix
Gregory Weston - 27 Jul 2008 17:01 GMT
In article
<97edc20b-ddd7-4aaa-9559-fc2dc5f9b10f@s50g2000hsb.googlegroups.com>,

> That is the path I have been going down but it seems it will be quite
> kludgy by the time it is all put together.  Since the callback
[quoted text clipped - 4 lines]
> As for intent, I am only providing decision support information for a
> particular online game.

I wasn't questioning your intent. I was correcting a very common error.
The phrase is not "intensive purposes;" it's "intents and purposes."

> Software serving the same purpose has existed
> on Windows for several years now, and is widely accepted within the
> community.

This might be a silly question, but have you checked with your
prospective Mac user base to see whether they would expect (or even
tolerate) having an ancillary window tagging along whenever they move
the main one? It might be the case that they expect (or even desire) to
place it independently and have it stay put. That would certainly be the
more typical (albeit not universal) behavior of things like that on the
Mac.

G

Signature

"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
  - Harry Potter and the Odor of the Phoenix

Sean Setter - 05 Sep 2008 19:01 GMT
The time critical nature of the game kind of eliminates that as a
realisitic approach.  The way the existing products in the Windows
environment overlay the information (which I am trying to mimic)
requires much less search time and is widely accepted.  Presumably,
since there are no Mac equivalent products in this user space, the
majority of the customers I intend to target will be converts from one
of the Windows products.  In other words, I believe that the end
result is what the prospective user will be looking for, including
myself.

I did find a flaw (or an obsticle not yet resolved) with window
layering.  The target application can have any number of windows open/
displayed at any given point in time (usually something between 2 and
16 windows) and the problem I am having is how to deal with
overlapping target windows.

Let me try and describe an example.  I have two windows open in the
target app, and Window1 is partially overlapping Window2.  The
information I want to display over Window1 is relevant only to
activities within Window1, and the same applies to Window2.  So when
Window1 is blocking the view of Window2, I need to either stop
displaying the "hidden" content or find a way to consitently place a
transparent overlay window such that it is always just higher than the
target window, but lower than any windows that could be layered above
it.  I would think that trying to let the window manager handle the
partial hiding and unhiding of content due to the layout/window order
of all windows on the desktop would be the best method, but I do not
know how to approach it.  Is there any way to get the window order of
all open windows, or trap some event when the key window changes (for
all windows, not just the windows belonging to my app)?

Suggestions of alternative methods are definitely welcome.

> In article
> <97edc20b-ddd7-4aaa-9559-fc2dc5f9b...@s50g2000hsb.googlegroups.com>,
[quoted text clipped - 28 lines]
> "Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
>    - Harry Potter and the Odor of the Phoenix
Gregory Weston - 06 Sep 2008 12:45 GMT
In article
<ea4a5f21-a3f1-4414-8c83-78c1fd59cb38@k13g2000hse.googlegroups.com>,

> The time critical nature of the game kind of eliminates that as a
> realisitic approach.

Huh? Status and information displays in time-critical situations (game
and otherwise) are generally fixed.

> The way the existing products in the Windows
> environment overlay the information (which I am trying to mimic)
> requires much less search time

A window in a fixed location requires no significant search time. (And
I'm using the word significant in the formal, mathematical sense rather
than using it in the common sense of being dismissive of something
ultimately meaningful.)

> and is widely accepted.

By Windows users. The question I asked was "have you checked with your
prospective Mac user base to see whether they would expect (or even
tolerate) having an ancillary window tagging along whenever they move
the main one?"

I'm guessing from your response ("Presumably...," "I believe that..."),
that the answer is "No. I have done no research at all into what the
needs or expectations of my intended target audience will be."

You asked for help. The help I offer is to recommend that you make sure
you're doing the right thing before you spend the resources to do what
may be the wrong thing the right way.

G

Signature

"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
  - Harry Potter and the Odor of the Phoenix

Sean Setter - 06 Sep 2008 18:43 GMT
I understand your concerns, and appreciate that you are trying to
help.

You are right that I have not asked anyone directly, but it has been
discussed in an open forum.  The general consensus is that the users
want a mac compatible version of the existing products.  The market
has already experimented with at least a handful of layouts, and the
one that I am trying to mimic, is the only one that remains.  The only
changes the layout has seen in a number of years are cosmetic in
nature.  99% of the features do not include changes to the layout
method.

The truth of the matter is, I knew this project was much more
complicated than anything I have attempted before.  So I have taken it
on primarily as an opportunity to improve my own abilities.  With that
in mind, I am making it for myself, and IF I build something that is
worthy of distribution, I will re-evaluate if and when I get closer to
that point.

I know this is a bit backwards, but for now, I am the primary
customer.  I think my desires from the final product are generally in
line with the market, but I still view this as secondary to creating
this for me.

> In article
> <ea4a5f21-a3f1-4414-8c83-78c1fd59c...@k13g2000hse.googlegroups.com>,
[quoted text clipped - 34 lines]
> "Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
>    - Harry Potter and the Odor of the Phoenix
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.