evSpecialKeyMsg usage or alternative?
evSpecialKeyMsg usage or alternative?
- Subject: evSpecialKeyMsg usage or alternative?
- From: Vincent Rosso <email@hidden>
- Date: Thu, 10 Mar 2005 14:13:09 -0800
I'm trying to simulate key presses of the brightness adjustment keys
(i.e. F1 and F2). I think evSpecialKeyMsg is what I need, and I know
how to call it but I'm having trouble with the framework.
evSpecialKeyMsg is declared in Kernel/IOKit/hidsystem/IOHIDSystem.h so
I added the Kernel framework to my application, but then the build
fails with:
ld: can't locate framework for: -framework Kernel
I'm doing this in a standard Cocoa Application created by Xcode. Is
the Kernel framework only accessible from kernel extensions? If it is,
how can I use evSpecialKeyMsg? Is there another way to send key
presses for the brightness keys?
I've successfully used CGPostKeyboardEvent, but as far as I can tell
that can't send special key commands (brightness, eject, etc).
I know it's at least possible because "SEC Helper" from the Salling
Clicker program can do it. You can run the AS:
tell application "SEC Helper" to simulate keyboard special key
brightness up
and it will act just as if you pressed the key.
SEC Helper is not a kernel extension and I don't want mine to be one
either.
Here is my code:
#import <Cocoa/Cocoa.h>
#include <Kernel/IOKit/hidsystem/IOHIDSystem.h>
int main(int argc, char *argv[])
{
evSpecialKeyMsg(0, 10, 0, 1);
return 0;
}
Thanks for your help!
vince
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden