1 用postmessage()和sendmessage()
2 用keybd_event
The keybd_event function synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls the keybd_event function.
Windows NT/2000/XP: This function has been superseded. Use SendInput instead.