6 Aug 2012 asmodai   » (Journeyer)

Detecting keyboard layout used on Windows

//Pseudo C/C# code:

int localeId = GetKeyboardLayout(0);

// The low word contains a Language Identifier for the input language
// and the high word contains a device handle to the physical layout
// of the keyboard.
localeId &= 0xffff;    // mask off high word to get the locale
                       // identifier

switch (localeId) {
    0x040c:
    0x080c:
    0x1009:
        useAzertyMapping();
    default:
        useQwertyMapping();
}

Relevant links:
GetKeyboardLayout()
Default Input Locales
Locale IDs assigned by Microsoft

Syndicated 2012-08-06 11:11:55 from In Nomine - The Lotus Land

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!