0
我需要在我的Qt應用程序上模擬keyPress(我在Mac OS X 10.6上)。在Mac OS X上使用CGEvent Qt
我寫了這個代碼:
#include <ApplicationServices/ApplicationServices.h>
...
CGEventRef mkey = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)46, true);
CGEventPost(kCGAnnotatedSessionEventTap, mkey);
CFRelease(mkey);
...
但有一個錯誤:
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
我想我有鏈接庫,但我不知道是哪個?
謝謝
尼科