Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I change default input language under tab language->Details (under Regional and language option) programmatically?

Thanks in advance,
M.H
Posted
Updated 23-Aug-10 9:15am
v3

1 solution

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:
C++
DWORD hKLEnglUS = 0x00000409;
if(!SystemParametersInfo(SPI_SETDEFAULTINPUTLANG, 0, &hKLEnglUS, SPIF_SENDCHANGE))
      TRACE(_T("Error code: %d"), GetLastError());

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]
 
Share this answer
 
v2
Comments
merh 23-Aug-10 9:48am    
Could you please give me a example how to change Default input language to English by the function SystemparameterInfo?
Nuri Ismail 24-Aug-10 3:30am    
I've updated my answer with working example. :)
merh 24-Aug-10 3:54am    
Thanks a lot for your help and it works as I have expected.
/M.H
Nuri Ismail 24-Aug-10 3:56am    
You're welcome! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900