How to get OS language using C ++ API?

I am developing an application that displays dialog boxes depending on the OS language. How can I get the OS language using C ++ or the Windows API (Windows 2008 / Vista / 7)?

+3
source share
3 answers

Windows has several functions, depending on the format in which you want to receive the information. Prior to Windows Vista, language information was encoded in LCID (locale identifier), which includes the language, as well as some sorting and formatting information.

For Windows Vista and Windows 7, a more flexible system called Locale Names was developed. GetSystemDefaultLocaleName

Use this if you want to work with Win2k and WinXP. GetSystemDefaultLCID

+4
source

Do you solve this problem?
If the answer is no, it’s
LPWSTR lpLocalName=NULLincorrect.
LPWSTR lpLocalName=NULL----> WCHAR localName[LOCALE_NAME_MAX_LENGTH]right. Since the memory allocation is not in GetUserDefaultLocalName.

+1
source

. . GetDefaultUILanguage .

+1
source

Source: https://habr.com/ru/post/1730351/


All Articles