in fact i am building a virtual开发者_开发知识库 keyboard how can i send a keyboard event to the program through pressing a button? thanks
You could use Quartz Event Servcices.
They provide CGEventCreateKeyboardEvent
which allows you to emulate any physical key-press.
The API is modeled after real key events.
So you have to call "Shift" + "Character" to get an upper case letter. You also need to release keys you have pressed.
Apple's documentation contains sample code.
Update:
We are talking about Mac OS X, right? Please add some tags to your original question.
精彩评论