Platform SDK: International Features

GetLocaleInfo

The GetLocaleInfo function retrieves information about a locale.

int GetLocaleInfo(
  LCID Locale,      // locale identifier
  LCTYPE LCType,    // information type
  LPTSTR lpLCData,  // information buffer
  int cchData       // size of buffer
);

Parameters

Locale
[in] Specifies the locale to retrieve information for. This parameter can be a locale identifier created by the MAKELCID macro, or one of the following predefined values.
Value Meaning
LOCALE_SYSTEM_DEFAULT Default system locale.
LOCALE_USER_DEFAULT Default user locale.

LCType
[in] Specifies the type of information to be retrieved. Note that only one type may be specified per call, except that an application may use the binary-OR operator to combine LOCALE_NOUSEROVERRIDE or LOCALE_USE_CP_ACP with any other LCTYPE value. For more information, see Locale Information.

If LOCALE_NOUSEROVERRIDE is combined with another value, the function bypasses user overrides, and returns the system default value for the requested LCID. The information is retrieved from the locale database, even if the LCID is the current one and the user has changed some of the values in Control Panel. If this flag is not specified, the values in Win.ini take precedence over the database settings when getting values for the current system default locale.

lpLCData
[out] Pointer to a buffer that receives the requested data.This pointer is not used if cchData is zero.
cchData
[in] Specifies the size, in TCHARs, of the lpLCData buffer. If cchData is zero, the function returns the number of bytes or characters required to hold the information, including the terminating null character, and the buffer pointed to by lpLCData is not used.

Return Values

If the function succeeds, the return value is the number of TCHARs written to the destination buffer. If the cchData parameter is zero, the return value is the number of bytes or characters required to hold the locale information.

If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes:

Remarks

The GetLocaleInfo function always retrieves information in text format. If the information is a numeric value, the function converts the number to text using decimal notation.

The LOCALE_FONTSIGNATURE parameter will return a non-NULL terminated string. In all other cases, the string is NULL terminated.

The ANSI string returned by the ANSI version of this function is translated from Unicode to ANSI based on the default ANSI code page for the LCID. However, if LOCALE_USE_CP_ACP is specified, the translation is based on the system default–ANSI code page.

Windows 2000: The ANSI version of this function will fail if it is used with a Unicode-only LCID. See Language Identifiers.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winnls.h; include Windows.h.
  Library: Use Kernel32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.

See Also

National Language Support Overview, National Language Support Functions, GetStringTypeA, GetStringTypeEx, GetStringTypeW, GetSystemDefaultLCID, GetUserDefaultLCID, LCTYPE Constants, SetLocaleInfo, MAKELCID