There are 2 means that the Win32 API provides the ability to send Keystrokes:
SendMessage
WM_KEYDOWN
WM_KEYUP