Retrieves information about a locale specified by name.
int GetLocaleInfoEx( LPCWSTR lpLocaleName, LCTYPE LCType, LPWSTR lpLCData, int cchData );
Pointer to a locale name, or one of the following predefined values.
The locale information to retrieve. For possible values, see the "Constants Used in the LCType Parameter of GetLocaleInfo, GetLocaleInfoEx, and SetLocaleInfo" section in Locale Information Constants. Note that only one piece of locale information can be specified per call.
The application can use the binary OR operator to combine LOCALE_RETURN_NUMBER with any other allowed constant. In this case, the function retrieves the value as a number instead of a string. The buffer that receives the value must be at least the length of a DWORD value, which is 2.
Starting with Windows Vista, your applications should not use <a href="https://msdn.microsoft.com/8f80a941-8ba6-4a0d-92fa-77230fe0a9d1">LOCALE_ILANGUAGE</a> in the <i>LCType</i> parameter to avoid failure or retrieval of unexpected data. Instead, it is recommended for your applications to call <b>GetLocaleInfoEx</b>.
Pointer to a buffer in which this function retrieves the requested locale information. This pointer is not used if cchData is set to 0.
Size, in characters, of the data buffer indicated by lpLCData. Alternatively, the application can set this parameter to 0. In this case, the function does not use the lpLCData parameter and returns the required buffer size, including the terminating null character.
Returns the number of characters retrieved in the locale data buffer if successful and cchData is a nonzero value. If the function succeeds, cchData is nonzero, and LOCALE_RETURN_NUMBER is specified, the return value is the size of the integer retrieved in the data buffer, that is, 2. If the function succeeds and the value of cchData is 0, the return value is the required size, in characters including a null character, for the locale data buffer.
The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, which can return one of the following error codes:
- ERROR_INSUFFICIENT_BUFFER. A supplied buffer size was not large enough, or it was incorrectly set to NULL.
- ERROR_INVALID_FLAGS. The values supplied for flags were not valid.
- ERROR_INVALID_PARAMETER. Any of the parameter values was invalid.
This function normally retrieves information in text format. If the information is a numeric value and the value of LCType is LOCALE_ILANGUAGE or LOCALE_IDEFAULTLANGUAGE, this function retrieves strings containing hexadecimal numbers. Otherwise, the retrieved text for numeric information is a decimal number.
There are two exceptions to this rule. First, the application can retrieve numeric values as integers by specifying LOCALE_RETURN_NUMBER in the LCType parameter. The second exception is that LOCALE_FONTSIGNATURE behaves differently from all other locale information constants. The application must provide a data buffer of at least sizeof(LOCALESIGNATURE) bytes. On successful return from the function, the buffer is filled in as a LOCALESIGNATURE structure.
int ret; CALID calid; DWORD value;
Examples showing the use of this function can be found in NLS: Name-based APIs Sample and NLS: Internationalized Domain Name (IDN) Mitigation Sample.
|Windows version||Windows Vista [desktop apps||UWP apps] Windows Server 2008 [desktop apps||UWP apps]|
|Header||winnls.h (include Windows.h)|