you need to use the scan code constant thingy for the letter "p" instead of just specifing it. Try this:
SendMessage(hwnd, WM_KEYDOWN, VK_P, NULL)
jumble
-----------
Microsoft patents ones and zeroes - remind you of Hasbro?
jumble-----------
This should also work if you want to use ASCII values (to differientiate between upper case and lower case easily for example):
SendMessage(hwnd, WM_CHAR, ''p'', NULL)
The program receiving the message must use TranslateMessage() before DispatchMessage() though.