Share via


CMonthCalCtrl::SetCalID

Sets the calendar identifier for the current month calendar control.

BOOL SetCalID(
     CALID calid
);

Parameters

Parameter

Description

[in] calid

One of the calendar identifier constants.

Return Value

true if this method is successful; otherwise, false.

Remarks

A calendar identifier specifies a region-specific calendar, such as the Gregorian (localized), Japanese, or Hijri calendars. Use the SetCalID method to display a calendar that is specified by the calid parameter if the locale that contains the calendar is installed on your computer.

This method sends the MCM_SETCALID message, which is described in the Windows SDK.

Requirements

Header: afxdtctl.h

This control is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

Example

The following code example defines the variable, m_monthCalCtrl, that is used to programmatically access the month calendar control. This variable is used in the next example.

 // Variable used to reference the month calendar control.
    CMonthCalCtrl m_monthCalCtrl;
    // Variable used to reference the splitbutton control.
    CSplitButton m_splitButton;

The following code example sets the month calendar control to display the Japanese Emperor Era calendar. The SetCalID method succeeds only if that calendar is installed on your computer.

    BOOL rc = m_monthCalCtrl.SetCalID(CAL_JAPAN);
    CString str = _T("Calendar change ");;
    if (rc == TRUE)
        str += _T("succeeded.");
    else {
        str += _T("failed.\n");
        str += _T("Perhaps this locale is not installed.");
    }
    AfxMessageBox(str, MB_ICONINFORMATION);

See Also

Reference

CMonthCalCtrl Class

Hierarchy Chart

MCM_SETCALID

Calendar Identifiers

CMonthCalCtrl::GetCalID