首页 > 解决方案 > 在 Windows 10 语言列表中添加语言条目

问题描述

我需要使用 C++ 和 MFC 框架在 Windows 10 运行时(特别是中文日文)中创建一个新的语言条目。

见下图:

在此处输入图像描述

我已经实现了一个虚拟键盘和一个语言设置对话框,它根据所选语言更改输入语言。我已经使用了 LoadKeyboardLayout 和 ActivateKeyboardLayout WINAPI 函数,适用于其他语言,但不适用于中文和日文(它需要两种语言都在 Windows 10 语言列表中才能工作)所以我想知道是否有任何方法可以动态添加这两种语言在 Windows 10 语言列表中。

请参见下面的代码:

void OSKSettingsDialog::SetKeyboardInputLanguage(LPCWSTR idLanguage)
{
    HKL desiredhk1 = LoadKeyboardLayout(idLanguage, 0);

    ActivateKeyboardLayout(desiredhk1, KLF_SETFORPROCESS);
}

    SetKeyboardInputLanguage(L"00000409"); //input locale id of english language(WORKS FINE)        
    SetKeyboardInputLanguage(L"00000804"); //input locale id of chinese (FAILS)
    SetKeyboardInputLanguage(L"00000411"); //input locale id of japanese (FAILS)
    SetKeyboardInputLanguage(L"00000816"); //input locale id of portuguese (WORKS FINE)

有什么办法吗?

我将不胜感激任何帮助。

标签: c++windowsconfigurationmfc

解决方案


推荐阅读