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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论