AXUIElementPostKeyboardEvent and Carbon applications
AXUIElementPostKeyboardEvent and Carbon applications
- Subject: AXUIElementPostKeyboardEvent and Carbon applications
- From: AstroK Software <email@hidden>
- Date: Tue, 21 Sep 2010 23:41:52 +0200
- Mailscanner-null-check: 1285710227.00731@kQIeDaH5cmKpfa2cflhl9g
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
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden