Keyboard Type Detection (Qwerty or Dvorak)

I was asked this question from a friend, and it aroused my curiosity, and so far I have not been able to find a solution, so I hope someone finds out.

Is there a way to programmatically determine what type of keyboard a user is using? My understanding of the keyboard is that the signal sent to the computer for “A” on the DVORAK keyboard matches the signal sent to the computer for “A” in the QUERTY keyboard. However, I read about ways to switch to / from dvorak , which emphasizes setting up the registry, but I hope there is a machine setting or something else that I can request.

Any ideas?

+5
source share
4 answers

, API WinKeyboardLayoutName() Win32. Dvorak . , U.S. Dvorak 00010409.

:

  public class Program
  {
    const int KL_NAMELENGTH = 9;

    [DllImport("user32.dll")]
    private static extern long GetKeyboardLayoutName(
          System.Text.StringBuilder pwszKLID); 

    static void Main(string[] args)
    {
      StringBuilder name = new StringBuilder(KL_NAMELENGTH);

      GetKeyboardLayoutName(name);

      Console.WriteLine(name);

    }
  }
+3

, , . , - , . ( , ...)

, : "A" , "A" qwerty... B -)

+3

, DirectInput DirectX. Dvorak, 50% , , (, , aoe wasd)

And yes, as Brian said, “A” is the same on both keyboards.

+3
source

Why does it matter? Depending on some special implementation, a keyboard is not a good idea at all. We use barcode scanners all over the place that emulate keyboard input. What would your program do with these devices? :)

PS: the registry entry mentioned arranges the keys of a regular keyboard into a dvorak layout.

+1
source

All Articles