有没有WinXP / WinXP嵌入式API来改变语言环境(具体来说,IME)?
我在WinXP上寻找一个API,以便在已安装的IME之间切换。
I am looking for an API on WinXP to switch between installed IME's.
这种情况是为了能够插入朗读键盘通过点击UI按钮(例如名为西班牙语的按钮)更改IME
The scenario is, to be able to plug in a langauge keyboard (say Spanish) and change the IME by clicking on a UI button (say button named Spanish)
例如我插入一个西班牙语键盘,然后点击名为西班牙语的UI按钮。
e.g. I plug in a Spanish keyboard and click on the UI button named Spanish. This should internally change the IME to Spanish, which is already installed
我试图更改区域设置/ IME(属于区域设置)。
我发现有一个名为SystemParametersInfo的api,它允许我们在系统级别进行设置。在我的情况下,我不得不去控制面板>区域设置>,然后在语言选项卡下安装的区域设置之间切换。最终可以通过编程实现:
I was trying to change the locale/ IME (which falls under the locale). I found that there is an api named, 'SystemParametersInfo' which allows us to make settings on system level. In my case, I had to go to Control Panel > Regional Settings > and then switch between installed locales under Language tab. This could finally be achieved programatically as shown in the code:
#include "stdafx.h"
#include "windows.h"
int _tmain(int argc, _TCHAR* argv[])
{
HKL hLangId = 0;
bool isFine;
DWORD errorCode;
errorCode = GetLastError();
isFine = SystemParametersInfo(SPI_GETDEFAULTINPUTLANG, 0, &hLangId, 0);
errorCode = GetLastError();
HKL spanishLanguage = (HKL) (0x040a0c0a);
isFine = SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, &spanishLanguage, 0);
errorCode = GetLastError();
return 0;
}