Platform SDK: International Features

SetCalendarInfo

The SetCalendarInfo function sets an item of locale information for a calendar.

int SetCalendarInfo(
  LCID Locale,       // locale
  CALID Calendar,    // calendar
  CALTYPE CalType,   // calendar information type
  LPCTSTR lpCalData  // calendar data
);

Parameters

Locale
[in] Locale identifier (LCID). The LCID can be created by the MAKELCID macro, or it can be one of the following predefined values.
Value Meaning
LOCALE_SYSTEM_DEFAULT Default system locale.
LOCALE_USER_DEFAULT Default user locale.

Calendar
[in] Identifier for the calendar whose information will be set.
CalType
[in] Type of calendar information to be set. Only one CALTYPE may be specified per call, except that an application may use the binary OR operator to combine CAL_USE_CP_ACP with any valid CALTYPE value. The CAL_USE_CP_ACP value is only used with the ANSI version of SetCalendarInfo

Windows 98: The following CALTYPE values are valid for this function:

CAL_NOUSEROVERRIDE
CAL_USE_CP_ACP
CAL_RETURN_NUMBER
CAL_ITWODIGITYEARMAX

For more information on CALTYPE values, see Calendar Type Information.

lpCalData
[in] Pointer to a null-terminated string that contains the calendar information. The information must be in the format of the specified CalType.

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

This function only affects the user override portion of the calendar settings; it does not set the system defaults.

The calendar 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 either Unicode or ANSI text.

Windows 98: CAL_ITWODIGITYEARMAX is only supported for Gregorian calendars.

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 2000.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Winnls.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also

National Language Support Overview, National Language Support Functions, GetCalendarInfo