Looking and searching for the best method to send a virtual key to another window with an API function. Currently, I'm using the 'keybd_event' API, which is used like this:

keybd_event VK_F5, 0, 0, 0

I'd like to be able to send the same information with SendMessage API if possible. I have tried the following to no avail:

SendMessage(theHWND, WM_CHAR, VK_F5, 0)
and
SendMessage(theHWND, WM_KEYDOWN, VK_F5, 0)
SendMessage(theHWND, WM_KEYUP, VK_F5, 0)

Does anyone have any code or idea how one could send the ACTUAL windows keypress to another windows program?

Thanks,
Phil