I am working on a project where you need to simulate keystrokes to trigger specific behaviors in another application.
Everything works fine and fine using the imported keybd_event function (maybe there are better ways, but it works fine).
Now I want to add some support for all the number keys.
Looking at e. here is http://msdn.microsoft.com/en-us/library/dd375731(v=VS.85).aspx or in the System.Windows.Input.Key namespace, I can easily find the keys for Num0 .. Num9, as well as for NumLock. But .. I can not find anything for Num /, Num +, NumEnter, etc.
I wrote a quick froms application to catch a keydown event, output event parameters and get interesting results:
e.KeyCode NumLock e.KeyData NumLock e.KeyValue 144 e.Modifiers None e.KeyCode Divide e.KeyData Divide e.KeyValue 111 e.Modifiers None e.KeyCode Multiply e.KeyData Multiply e.KeyValue 106 e.Modifiers None e.KeyCode Subtract e.KeyData Subtract e.KeyValue 109 e.Modifiers None e.KeyCode Add e.KeyData Add e.KeyValue 107 e.Modifiers None e.KeyCode NumLock e.KeyData NumLock e.KeyValue 144 e.Modifiers None e.KeyCode NumLock e.KeyData NumLock e.KeyValue 144 e.Modifiers None e.KeyCode Divide e.KeyData Divide e.KeyValue 111 e.Modifiers None e.KeyCode Multiply e.KeyData Multiply e.KeyValue 106 e.Modifiers None e.KeyCode Subtract e.KeyData Subtract e.KeyValue 109 e.Modifiers None e.KeyCode Add e.KeyData Add e.KeyValue 107 e.Modifiers None e.KeyCode Return e.KeyData Return e.KeyValue 13 e.Modifiers None
Num + Key (and so on) appear to be keys that Windows calls function keys (for example, F18 for the Num + key). So .. this is strange, but normal.
But .. I can not distinguish Enter-Key from NumEnter Key. They are different for my application, so I have to send specific keycodes for both.
And this is my question: how can I send a regular input key and how can I send a NumEnter key?
(I don't know if any value matters, I'm on a German layout.)
Thanks for any ideas!
source share