I am in the process of developing a application which displays the dialogues depending on the OS Language(Windows 2008/Vista/Windows7). How I can get the OS language using C++ or Windows APIs. Thanks in advance Santhosh
+3
A:
There are several functions to do this in Windows, depending on what format you want the information in. Prior to Windows Vista, the language information was encoded into a LCID (Locale Id) which includes language, as well as some information about sorting and formatting.
For Windows Vista and Windows 7, a more flexible system called Locale Names was devised. GetSystemDefaultLocaleName
Use this if you want to work on Win2k and WinXP. GetSystemDefaultLCID
John Knoeller
2010-01-28 09:40:00
Hi, I have tried to create application using "GetUserDefaultLocaleName". But i am getting below errors during compilation. error C3861: 'GetUserDefaultLocaleName': identifier not found I have tried including "Windows.h" and "Winnls.h". No improvements in this case also.. Plz help. Thanks in advance.
Santhosha
2010-01-29 04:41:29
You must be using recent versions of the windows header files (Visual Studio 2008 or 2010) and you need to `#define WINVER 0x0600` or larger, otherwise the header files won't let you access API's that aren't available before windows Vista.
John Knoeller
2010-01-29 05:57:44
Yes.. Its done.. Thanks a lot John.. You made my day:)
Santhosha
2010-01-29 08:37:57
Hi,int main(){ LPWSTR lpLocaleName=NULL; cout<<"Calling GetUserDefaultLocaleName";int ret = GetUserDefaultLocaleName(lpLocaleName,LOCALE_NAME_MAX_LENGTH);return 0;}This is the program i wrote, when i run this exe on Windows 2008 application crashes. Can anyone please help!!Thanks in advanceSanthos
Santhosha
2010-02-02 10:15:44
+1
A:
Do you resolve this problem? If answer is No, LPWSTR lpLocalName=NULL is wrong. LPWSTR lpLocalName=NULL ----> WCHAR localName[LOCALE_NAME_MAX_LENGTH] is right. Because No memory allocation is in GetUserDefaultLocalName.
JungHwan Jeong
2010-06-18 02:06:56