2011-04-06 72 views

回答

3

看看這些電話,但您需要正確設置code,這可以取決於當前所選的鍵盤。

CGEventRef event; 
event = CGEventCreateKeyboardEvent (NULL, code, down); 
CGEventPost(kCGSessionEventTap, event); 
CFRelease(event); 

http://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/func/CGEventCreateKeyboardEvent

+0

感謝輸入,但我怎麼發送到後臺運行特定的應用程序? – user635064 2011-04-06 18:04:21

+2

改爲使用'CGEventPostToPSN'。 – 2011-04-06 19:28:35

+0

我想通了,但謝謝! – user635064 2011-04-06 19:40:39

相關問題