Click here to Skip to main content
15,885,695 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use NtSetDefaultLocale to change unicode language to Russian programmatically.
I can see that the unicode Language used for Non-Unicode Programs has been changed and the button is also disabled but when I try to write russian words in notepad and try to save it I get the message that the lines containing the unicode and they will be lost.
Could you please help me with this issue?

In normal case when I change unicode language manually I have to restart the computer to see the changes.
Is there other ways to change Non-Unicode programmatically to Russian?

My code is as below:
C++
typedef NTSYSAPI UINT_PTR (NTAPI *FP)(BOOL bUserProf, PLCID plcId);
typedef DWORD
( NTAPI *NTSETDEFAULTLOCALE)(

  IN BOOLEAN              UserProfile,
  IN LCID               DefaultLocaleId );

 NTSETDEFAULTLOCALE lpfnFuncSet = NULL; 
 HINSTANCE hCoreDll = LoadLibrary(TEXT("ntdll.dll")); 
lpfnFuncSet = (NTSETDEFAULTLOCALE)GetProcAddress(hCoreDll, _T("NtSetDefaultLocale"));
if (lpfnFuncSet)
{
  dwTemp = lpfnFuncSet(FALSE, 0x419);
}

Thanks in advance
M.H
Posted
Updated 2-Sep-10 21:09pm
v3

1 solution

First of all, there is no supported way to programatically change the system locale (which is on Windows XP called "Language for non-Unicode programs" but it has other names on other Windows versions). NtSetDefaultLocale is an undocumented function that Microsoft may remove or change at any time.

Having said all that, if you call NtSetDefaultLocale, you'll probably need to restart the computer for the change to take effect, just as when you change this setting programatically.
 
Share this answer
 
Comments
merh 2-Sep-10 15:31pm    
I have windows XP. I restart the computer but the changing dosent take effect.

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