In this case I hit the enter key, and it breaks into the debugger so I can see what I hit.
It works for letters, but all I’m really interested in capturing are things like Enter, Return, Delete, etc. Those all come up blank.
So is there a list somewhere that I can reference that contains all the non-alphabetical keys?
Also, related question: The app I’m making will likely be used by people with non-US keyboards. I’m only interested in capturing non-alphabetical keys. Are those keys different for different language keyboards, or are they consistent across all because they’re not letters? If they are different, how do I handle that?
Using String.Asc to get the numeric value of the key for comparison is probably the most straightforward way.
var keyCode as Integer = key.Asc
Select Case keyCode
Case 28 '// Left Arrow
...
End Select
Pipe it to System.DebugLog or use a breakpoint to inspect the value.
The app I’m making will likely be used by people with non-US keyboards. I’m only interested in capturing non-alphabetical keys. Are those keys different for different language keyboards, or are they consistent across all because they’re not letters? If they are different, how do I handle that?
Right. But the Keyboard Viewer app only shows you the keyboard layout for the kind of keyboard that’s currently connected to the computer. So you can’t (as far as I can tell) change the Keyboard Viewer to simulate a keyboard in another language while you have a US keyboard set up on that machine. I think you can change it in the control panel temporarily, but that’s making a system wide change, which is a pain if you’re trying to type out what you’re doing, because your keyboard layout is constantly changing.
KeyDown does not rely on the keyboard layout, unlike Keyboard.AsynchKeyDown. By the time KeyDown is called, Key has been translated to the actual character.