Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In normal case from Control panel I select Regional and language Options and then to the Advance tab to note the language used under "Language used for Non-Unicode Programs"
my question is how to retrieve programmatically by C++ the language name used under "Language used for Non-Unicode Programs"?
Thanks in Advanced
M.H
Posted

1 solution

Try it :) :

{
  LCID lcId(0);
  NtQueryDefaultLocale(FALSE, &lcId);
  //... 
 
} 


...or try to check the dependency of the "Default" entry under the registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Locale
 
Share this answer
 
v2
Comments
merh 19-Aug-10 15:53pm    
thanks, could you please tell me what I need to use "NtQueryDefaultLocale"? Because I get error message.
Eugen Podsypalnikov 20-Aug-10 2:26am    
Probably, it will be possible to load and call it from the ntdll.dll (LoadLibrary/GetProcAddress/...) :)
merh 20-Aug-10 8:33am    
It seems that I can load "ntdll" and seems also GetProcAddres works but
LCID lcId(0); NtQueryDefaultLocale(FALSE, &lcId); dosent work.

HINSTANCE hInstLibrary = LoadLibrary("ntdll.dll");
if (hInstLibrary)
{
FARPROC farproc = GetProcAddres(hInstLibrary, "NtQueryDefaultLocale");
LCID lcId(0);
NtQueryDefaultLocale(FALSE, &lcId);
FreeLibrary(hInstLibrary)
}
Eugen Podsypalnikov 20-Aug-10 9:13am    
Nearly... :) :

typedef NTSYSAPI UINT_PTR (NTAPI *FP)(BOOL bUserProf, PLCID plcId);

LCID GetLocaleID()
{
LCID lcId(0);
HMODULE hLib = LoadLibrary(_T("ntdll.dll"));
if (hLib) {
FP fp = (FP) GetProcAddress(hLib, "NtQueryDefaultLocale");
if (fp) {
(*fp)(FALSE, &lcId);
}
FreeLibrary(hLib);
}
return lcId;
}
merh 20-Aug-10 15:44pm    
It works fine and thanks a lot for your help
Best Regards
M.H

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