on 2008-07-09 1:58 PM, James Montgomerie at [EMAIL PROTECTED] wrote:

>> You can register to observe the accessibility notifications
>> AXApplicationActivated and AXApplicationDeactivated. These require
>> you to
>> register to observe a specific target application. Therefore, in
>> order to
>> catch every application switch, use the NSWorkspace -activeApplication
>> method to get the name of the current active application, register to
>> observe when it deactivates, then when it does deactivate get the new
>> -activeApplication and register to observe when it deactivates, and
>> so on.
>> 
>> See Apple's iChatStatusFromApplication sample code for Leopard to see
>> exactly how to implement this.
> 
> This does require, though, that the user has "Enable access for
> assistive devices" enabled in the Universal Access preferences pane
> (the Carbon method does not).

In Leopard, you can make your application process trusted by the
accessibility API (requires user authentication), using the
AXMakeProcessTrusted function. Then you don't need to ask your users to
enable global access for assistive devices. However, making your process
trusted is not easy -- you have to embed a couple of helper applications in
your application package, one of them to run as root and make your process
trusted, and the other to relaunch your application so the newly-trusted
process is running. If you have an easier way to accomplish your goal, go
for it.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to