Please see more thoroughly:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646293%28v=vs.85%29.aspx[
^].
This API works with virtual keys, same as, for example, .NET
System.Windows.Forms.KeyCode
. Those key codes are not scan codes, and not character codes as ASCII or Unicode UTFs.
Basically, the keyboard is processed like this: scan code -> virtual keys -> characters (including delete) or non-character events (such as
KeyUp
,
KeyDown
for non-character keys).
Please also look at .NET keyboard events (no matter,
System.Windows.Forms
or WPF) and compare the data passed to event handlers with Windows API information. It should help you to understand what you are really doing. I, for example, don't understand what you are trying to achieve. Chances are, pure .NET FCL could help you more. Remember that P/Invoke can kill platform compatibility, so pure .NET is always better. I admit there are certain cases when using raw Windows API is unavoidable, but such cases are relatively rare. If you explain your goal, you can get a chance to receive some more advice.
—SA