Re: Sending a keystroke
Re: Sending a keystroke
- Subject: Re: Sending a keystroke
- From: Paul Haddad <email@hidden>
- Date: Sat, 21 Sep 2002 21:14:42 -0500
Hi All,
On Saturday, September 21, 2002, at 02:24 PM, Sam Taylor wrote:
I have my own question on this subject - how do I get the computer to
(temporarily) ignore any modifier keys the user is holding. If I am
trying to send a keyboard shortcut to an application, but the user is
holding down option then either the wrong thing will happen or the
computer will just beep. Using CGPostKeyboardEvent to simulate keyups
for all modifiers down doesn't seem to work. Has anyone solved this?
This seems to work, though I'm not sure if its the "correct" way to do
it......
CGInhibitLocalEvents(YES);
CGEnableEventStateCombining(NO);
CGSetLocalEventsFilterDuringSupressionState(kCGEventFilterMaskPermitAllE
vents, kCGEventSupressionStateSupressionInterval);
CGPostKeyboardEvent((CGCharCode)NULL, (CGKeyCode)55, true);
CGPostKeyboardEvent((CGCharCode)'v', (CGKeyCode)9, true);
CGPostKeyboardEvent((CGCharCode)'v', (CGKeyCode)9, false);
CGPostKeyboardEvent((CGCharCode)NULL, (CGKeyCode)55, false);
CGEnableEventStateCombining(YES);
CGInhibitLocalEvents(NO);
---
Paul Haddad (aim:ETS Paul)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.