Platform SDK: International Features

SetLocaleInfo

The SetLocaleInfo function sets an item of locale information. This setting only affects the user override portion of the locale settings; it does not set the system defaults.

BOOL SetLocaleInfo(
  LCID Locale,       // locale identifier
  LCTYPE LCType,     // information type
  LPCTSTR lpLCData   // information buffer
);

Parameters

Locale
[in] Specifies the locale whose information the function will set. The locale provides a context for the string mapping or sort key generation. An application can use the MAKELCID macro to create a locale identifier.
LCType
[in] Specifies the type of locale information to be set by the function. Note that only one LCTYPE may be specified per call. Not all LCTYPE values are valid; see the list of valid LCTYPE values in the following Remarks section.
lpLCData
[in] Pointer to a null-terminated string containing the locale information the function will set. The information must be in the specified LCTYPE's particular format.

Return Values

If the function succeeds, the return values is a nonzero value.

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 locale information is always passed in as a null-terminated Unicode string in the Unicode version of the function, and as a null-terminated ANSI string in the ANSI version. No integers are allowed by this function; any numeric values must be specified as Unicode or ANSI text. Each LCTYPE has a particular format, as noted in Locales. Note that several of the LCTYPE values are linked together, so that changing one changes another value as well. For more information, see Locale Information.

Only the following LCTYPE values are valid for this function:

LOCALE_ICALENDARTYPE LOCALE_SDATE
LOCALE_ICURRDIGITS LOCALE_SDECIMAL
LOCALE_ICURRENCY LOCALE_SGROUPING
LOCALE_IDIGITS LOCALE_SLIST
LOCALE_IFIRSTDAYOFWEEK LOCALE_SLONGDATE
LOCALE_IFIRSTWEEKOFYEAR LOCALE_SMONDECIMALSEP
LOCALE_ILZERO LOCALE_SMONGROUPING
LOCALE_IMEASURE LOCALE_SMONTHOUSANDSEP
LOCALE_INEGCURR LOCALE_SNEGATIVESIGN
LOCALE_INEGNUMBER LOCALE_SPOSITIVESIGN
LOCALE_IPAPERSIZE LOCALE_SSHORTDATE
LOCALE_ITIME LOCALE_STHOUSAND
LOCALE_S1159 LOCALE_STIME
LOCALE_S2359 LOCALE_STIMEFORMAT
LOCALE_SCURRENCY LOCALE_SYEARMONTH

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

Requirements

  Windows NT/2000: Requires Windows NT 3.5 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, GetLocaleInfo, MAKELCID