开发者

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 开发者_Go百科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!

Aaron


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).

See:
http://www.cplusplus.com/reference/iostream/ios_base/imbue/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜