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?

有帮助吗?

解决方案

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"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top