I need to simulate keyPress in my Qt application (I am on mac Os X 10.6).
I wrote this code:
#include <ApplicationServices/ApplicationServices.h> ... CGEventRef mkey = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)46, true); CGEventPost(kCGAnnotatedSessionEventTap, mkey); CFRelease(mkey); ...
But there is an error:
Undefined symbols: "_CGEventCreateKeyboardEvent", referenced from: SimuleEvent::PressControl(QString) in simuleevent.o "_CGEventPost", referenced from: SimuleEvent::PressControl(QString) in simuleevent.o "_CFRelease", referenced from: SimuleEvent::PressControl(QString) in simuleevent.o
I think I need to link the library, but I donβt know what?
thanks
Niko
source share