Vb.net get keyboard layout

2.2k views Asked by At

I'm currently learning the DVORAK layout on my QWERTY keyboard, which means that when I want to use keyboard shortcuts, such as Ctrl + C, in DVORAK that ends up being Ctrl + J, the convenience is lost when I have to use two hands to hit various commands. Windows does not appear to have a way to change the shortcuts, and autohotkey scripts do not work when you switch back to QWERTY, they instead ruin shortcut functionality for QWERTY until you exit the script.

So what I want to do is make my own program that will detect your layout and send the right keys, but first I need to detect which keyboard layout the user is using, and I can't seem to figure out how.

Is there a way to easily determine which keyboard layout someone is using?

1

There are 1 answers

0
Postman On BEST ANSWER

I stumbled upon the right answer fortunately,

InputLanguage.CurrentInputLanguage.LayoutName

Returns a string.

If your format is regular old QWERTY english, it returns "US"

If it's DVORAK(United-States) it returns "United States-Dvorak"