Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need to find which window is active



On Oct 31, 2003, at 9:20 PM, Eric Schlegel wrote:

On Oct 31, 2003, at 8:14 PM, Modesitt Software wrote:

I too could use this functionality. I didn't see anything useful in the accessibility APIs.

Using the accessibility APIs, you'd do something like this:

- get the pid_t of an application
- call AXUIElementCreateApplication with that pid
- call AXObserverCreate with that pid
- call AXObserverAddNotification with that AXUIElementRef and observer, passing kAXMainWindowChangedNotification as the notification
- call AXObserverGetRunLoopSource on that observer
- call CFRunLoopAddSource( GetCFRunLoopFromEventLoop( GetMainEventLoop() ), passing that run loop source

Now your callback proc should be called when the main window (i.e., the active window) of that application changes.

-eric

I finally had a chance to look into this more, however, I'm having a difficult time obtaining additional information about these calls. I searched Apple Developer Connection for AXUIElementCreateApplication, and I found only one reference to it, as a preliminary draft:

http://developer.apple.com/documentation/ReleaseNotes/Accessibility/ AssistiveAPI.html

The draft says "Look in the HIServices/Accessibility.h and associated files for the complete and most current set of declarations" but I cannot find Accessibility.h anywhere. Does this file even exist? If so, where?

Thank you,
Bill Modesitt
---
Modesitt Software
<http://www.modesittsoftware.com>
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.