Hi,

sorry if it's not exactly a Cocoa question, but my application is written in 
Cocoa and it uses Carbon calls to accessibility functions.

So I am writing a Cocoa application for disabled that must be able to send key 
presses to background application. For that I am using 
AXUIElementPostKeyboardEvent which works quite fine, except when I want to send 
key presses to Carbon apps like Microsoft Word or iTunes when they are in the 
background. For Cocoa apps there is no absolutely no problem! Have you ever 
encountered a behavior like this?

I am using the following code:

if (type == kCGEventKeyDown)
{
        keyDown = true;
        err = AXUIElementPostKeyboardEvent(backgroundApp, (CGCharCode)0, 
(CGKeyCode)keyCode, keyDown);
}
else if (type == kCGEventKeyUp)
{
        keyDown = false;
        err = AXUIElementPostKeyboardEvent(backgroundApp, (CGCharCode)0, 
(CGKeyCode)keyCode, keyDown);
}

This is strange because when Carbon apps are in the foreground it works fine. 
Do you think it could be related to the fact that my application is written in 
Cocoa?

Thanks in advance,

 -- Arthur;

--
Arthur VIGAN
AstroK Software
cont...@astrok-software.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 arch...@mail-archive.com

Reply via email to