According to documentation of WM_KEYUP/WM_KEYDOWN you need to specify the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag.
I recently wrote a small
article on how to easily do this in Delphi.