如何以编程方式在标签语言->详细信息下更改默认输入语言?

如何以编程方式在标签语言->详细信息下更改默认输入语言?

问题描述:

如何通过编程方式在选项卡语言->详细信息(在区域和语言选项下)下更改默认输入语言?

预先感谢,
MH

How can I change default input language under tab language->Details (under Regional and language option) programmatically?

Thanks in advance,
M.H

我认为您可以使用SPI_SETDEFAULTINPUTLANG的"New Window> ^ ] API. :)

[更新]
很抱歉您的回答很晚. :(
因此,您需要一个示例来将默认输入语言更改为英语.
然后是示例:
I think that you can use SystemParametersInfo[^] API with action parameter SPI_SETDEFAULTINPUTLANG. :)

[UPDATE]
Hi, sorry for the late answer. :(
So, you need an example to change the default input language to English.
Then here is the example:
DWORD hKLEnglUS = 0x00000409;
if(!SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, &hKLEnglUS, SPIF_SENDCHANGE))
      TRACE(_T("Error code: %d"), GetLastError());


这对我来说很好. :)

注意,我必须告诉您,首先我尝试使用SystemParametersInfo并从LoadKeyboardLayout返回结果,但SystemParametersInfo失败,错误代码998(对内存位置的无效访问).
之后,我发现HKL是指向DWORD的指针,该指针包含语言标识符.
您可以在 [


This works fine for me. :)

As a note I have to tell you that first I''ve tried using SystemParametersInfo with result returned from LoadKeyboardLayout but SystemParametersInfo failed with error code 998 (Invalid access to memory location).
After that I found that HKL is a pointer to DWORD that contains the the language identifier.
You can see the language identifiers table in this[^] MSDN page. As you can see from the example I''m using the constant 0x0409 (but with additional zeroes for the HIWORD part), which stands for English US.
I hope this helps.
:)
[/UPDATE]