I use globalKeyboardHook to detect certain keyboard keys. The keyboard is a standard English Microsoft 101 keys. For multiple languages, I need all the alphabet (no numerical) and the punctuation (period comma [ ] + = _ - ' ; and some similar. I do not want the control chars to be included.
To filter in the keys I need, I use the char.Isletter || char.isPunctuation. To my surprise, I found out that with the keyboardGlobalHook, the char.IsPunctuation do not return the standard punctuation (period, comma and more). It seems as if the returned keyCodes and keyValues are different with the hook. When running the same char.isPunctuation in a simple test program without the hook, it returns the correct (?) list of punctuation keys as follows:
39 ''':
40 '(':
41 ')':
42 '*':
44 ',':
45 '-':
46 '.':
47 '/':
58 ':':
59 ';':
63 '?':
64 '@':
91 '[':
92 '\':
93 ']':
95 '_':
123 '{':
125 '}':
161 '¡':
171 '«':
173 '-':
183 '·':
187 '»':
191 '¿':
How can I filter only the keys I need, using the built-in char.Is... filters? (I could naturally make a list of all the keys I need, but for that I will need to run the global hook and press each key to determine the returned code).