Change input locale (keyboard -- left shift+ alt + 1) key sequence PROGRAMMATICALLY
On XP, if you go to
control panel -> regional and language Options -> Languages Tab -> Details ->
If you have more than one keyboard in use, then, click Key Settings. Those are the settings I would like to change. I would like to set it up so that the DVORAK keyboard is Left Alt + Shift + 1. I can use C++, C# or whatever. I already know how to load a keyboard:
HKL dvorakhkl = LoadKeyboardLayout(TEXT("00010409"), 0);
That loads the dvorak keyboard. This sets it to default:
SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, (PVOID)&dvorakhkl, 0);
Also, I can change the top part of said dialog box
"Switch between Input Languages"
UINT val = 1;//"1" = ALT+SHIFT, "2" = CTRL+SHIFT, and "3" = none. System.ParametersInfo(SPI_SETLANGTOGGLE, 0, 0, val);
Let me know if you can help. Thanks!
By default all programs use the C local (Because we all program in C dialects I suppose)
You can imbue streams with an appropriate local. Just remember that you must imbue the stream before opening/using it. An attempt to imbue a stream after it has been opened/used will be silently ignored.
This means that for std::cin and std::cout you should probably do it immediately on startup in main() to avoid the potential of them being used.
When creating a locale object if you specify the empty striung it will pick up the name of the local from the environment (ie one of the environment variables).