This section contains information about programming elements used with month calendar controls.
Overviews
About Month Calendar Controls
A month calendar control implements a calendar-like user interface.
MONTHDAYSTATE
The MONTHDAYSTATE data type is a bit field that holds the state of each day in a month.
Using Month Calendar Controls
This section provides information about programming month calendar controls.
Macros
MonthCal_GetCalendarBorder
Gets the border size, in pixels, of a month calendar control. You can use this macro or send the MCM_GETCALENDARBORDER message explicitly.
MonthCal_GetCalendarCount
Gets the number of calendars currently displayed in the calendar control. You can use this macro or send the MCM_GETCALENDARCOUNT message explicitly.
MonthCal_GetCalendarGridInfo
Gets information about a calendar grid.
MonthCal_GetCALID
Gets the current calendar ID for the given calendar control. You can use this macro or send the MCM_GETCALID message explicitly.
MonthCal_GetColor
Retrieves the color for a given portion of a month calendar control. You can use this macro or send the MCM_GETCOLOR message explicitly.
MonthCal_GetCurrentView
Gets the view for a month calendar control. You can use this macro or send the MCM_GETCURRENTVIEW message explicitly.
MonthCal_GetCurSel
Retrieves the currently selected date. You can use this macro or send the MCM_GETCURSEL message explicitly.
MonthCal_GetFirstDayOfWeek
Retrieves the first day of the week for a month calendar control. You can use this macro or send the MCM_GETFIRSTDAYOFWEEK message explicitly.
MonthCal_GetMaxSelCount
Retrieves the maximum date range that can be selected in a month calendar control. You can use this macro or send the MCM_GETMAXSELCOUNT message explicitly.
MonthCal_GetMaxTodayWidth
Retrieves the maximum width of the "today" string in a month calendar control. This includes the label text and the date text. You can use this macro or send the MCM_GETMAXTODAYWIDTH message explicitly.
MonthCal_GetMinReqRect
Retrieves the minimum size required to display a full month in a month calendar control. Size information is presented in the form of a RECT structure. You can use this macro or send the MCM_GETMINREQRECT message explicitly.
MonthCal_GetMonthDelta
Retrieves the scroll rate for a month calendar control. The scroll rate is the number of months that the control moves its display when the user clicks a scroll button. You can use this macro or send the MCM_GETMONTHDELTA message explicitly.
MonthCal_GetMonthRange
Retrieves date information (using SYSTEMTIME structures) that represents the high and low limits of a month calendar control's display. You can use this macro or send the MCM_GETMONTHRANGE message explicitly.
MonthCal_GetRange
Retrieves the minimum and maximum allowable dates set for a month calendar control. You can use this macro or send the MCM_GETRANGE message explicitly.
MonthCal_GetSelRange
Retrieves date information that represents the upper and lower limits of the date range currently selected by the user. You can use this macro or send the MCM_GETSELRANGE message explicitly.
MonthCal_GetToday
Retrieves the date information for the date specified as "today" for a month calendar control. You can use this macro or send the MCM_GETTODAY message explicitly.
MonthCal_GetUnicodeFormat
Retrieves the Unicode character format flag for the control. You can use this macro or send the MCM_GETUNICODEFORMAT message explicitly.
MonthCal_HitTest
Determines which portion of a month calendar control is at a given point on the screen. You can use this macro or send the MCM_HITTEST message explicitly.
MonthCal_SetCalendarBorder
Sets the border size, in pixels, of a month calendar control. You can use this macro or send the MCM_SETCALENDARBORDER message explicitly.
MonthCal_SetCALID
Sets the calendar ID for the given calendar control. You can use this macro or send the MCM_SETCALID message explicitly.
MonthCal_SetColor
Sets the color for a given portion of a month calendar control. You can use this macro or send the MCM_SETCOLOR message explicitly.
MonthCal_SetCurrentView
Sets the view for a month calendar control. You can use this macro or send the MCM_SETCURRENTVIEW message explicitly.
MonthCal_SetCurSel
Sets the currently selected date for a month calendar control. If the specified date is not in view, the control updates the display to bring it into view. You can use this macro or send the MCM_SETCURSEL message explicitly.
MonthCal_SetDayState
Sets the day states for all months that are currently visible within a month calendar control. You can use this macro or send the MCM_SETDAYSTATE message explicitly.
MonthCal_SetFirstDayOfWeek
Sets the first day of the week for a month calendar control. You can use this macro or send the MCM_SETFIRSTDAYOFWEEK message explicitly.
MonthCal_SetMaxSelCount
Sets the maximum number of days that can be selected in a month calendar control. You can use this macro or send the MCM_SETMAXSELCOUNT message explicitly.
MonthCal_SetMonthDelta
Sets the scroll rate for a month calendar control. The scroll rate is the number of months that the control moves its display when the user clicks a scroll button. You can use this macro or send the MCM_SETMONTHDELTA message explicitly.
MonthCal_SetRange
Sets the minimum and maximum allowable dates for a month calendar control. You can use this macro or send the MCM_SETRANGE message explicitly.
MonthCal_SetSelRange
Sets the selection for a month calendar control to a given date range. You can use this macro or send the MCM_SETSELRANGE message explicitly.
MonthCal_SetToday
Sets the "today" selection for a month calendar control. You can use this macro or send the MCM_SETTODAY message explicitly.
MonthCal_SetUnicodeFormat
Sets the Unicode character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control. You can use this macro or send the MCM_SETUNICODEFORMAT message explicitly.
MonthCal_SizeRectToMin
Calculates how many calendars will fit in the given rectangle, and then returns the minimum size that a rectangle needs to be to fit that number of calendars. You can use this macro or send the MCM_SIZERECTTOMIN message explicitly.
Messages
MCM_GETCALENDARBORDER
Gets the size of the border, in pixels. You can send this message explicitly or by using the MonthCal_GetCurrentView macro.
MCM_GETCALENDARCOUNT
Gets the number of calendars currently displayed in the calendar control. You can send this message explicitly or by using the MonthCal_GetCalendarCount macro.
MCM_GETCALENDARGRIDINFO
Gets information about a calendar grid.
MCM_GETCALID
Gets the calendar ID for the given calendar control. You can send this message explicitly or by using the MonthCal_GetCALID macro.
MCM_GETCOLOR
Retrieves the color for a given portion of a month calendar control. You can send this message explicitly or by using the MonthCal_GetColor macro.
MCM_GETCURRENTVIEW
Gets the current view of the calendar. You can send this message explicitly or by using the MonthCal_GetCurrentView macro.
MCM_GETCURSEL
Retrieves the currently selected date. You can send this message explicitly or by using the MonthCal_GetCurSel macro.
MCM_GETFIRSTDAYOFWEEK
Retrieves the first day of the week for a month calendar control. You can send this message explicitly or by using the MonthCal_GetFirstDayOfWeek macro.
MCM_GETMAXSELCOUNT
Retrieves the maximum date range that can be selected in a month calendar control. You can send this message explicitly or by using the MonthCal_GetMaxSelCount macro.
MCM_GETMAXTODAYWIDTH
Retrieves the maximum width of the "today" string in a month calendar control. This includes the label text and the date text. You can send this message explicitly or by using the MonthCal_GetMaxTodayWidth macro.
MCM_GETMINREQRECT
Retrieves the minimum size required to display a full month in a month calendar control. You can send this message explicitly or by using the MonthCal_GetMinReqRect macro.
MCM_GETMONTHDELTA
Retrieves the scroll rate for a month calendar control. The scroll rate is the number of months that the control moves its display when the user clicks a scroll button. You can send this message explicitly or by using the MonthCal_GetMonthDelta macro.
MCM_GETMONTHRANGE
Retrieves date information (using SYSTEMTIME structures) that represents the high and low limits of a month calendar control's display. You can send this message explicitly or by using the MonthCal_GetMonthRange macro.
MCM_GETRANGE
Retrieves the minimum and maximum allowable dates set for a month calendar control. You can send this message explicitly or by using the MonthCal_GetRange macro.
MCM_GETSELRANGE
Retrieves date information that represents the upper and lower limits of the date range currently selected by the user. You can send this message explicitly or by using the MonthCal_GetSelRange macro.
MCM_GETTODAY
Retrieves the date information for the date specified as "today" for a month calendar control. You can send this message explicitly or by using the MonthCal_GetToday macro.
MCM_GETUNICODEFORMAT
Retrieves the Unicode character format flag for the control. You can send this message explicitly or use the MonthCal_GetUnicodeFormat macro.
MCM_HITTEST
Determines which portion of a month calendar control is at a given point on the screen. You can send this message explicitly or by using the MonthCal_HitTest macro.
MCM_SETCALENDARBORDER
Sets the size of the border, in pixels. You can send this message explicitly or by using the MonthCal_SetCurrentView macro.
MCM_SETCALID
Sets the calendar ID for the given calendar control. You can send this message explicitly or by using the MonthCal_SetCALID macro.
MCM_SETCOLOR
Sets the color for a given portion of a month calendar control. You can send this message explicitly or by using the MonthCal_SetColor macro.
MCM_SETCURRENTVIEW
Sets the current view of the calendar. You can send this message explicitly or by using the MonthCal_SetCurrentView macro.
MCM_SETCURSEL
Sets the currently selected date for a month calendar control. If the specified date is not in view, the control updates the display to bring it into view. You can send this message explicitly or by using the MonthCal_SetCurSel macro.
MCM_SETDAYSTATE
Sets the day states for all months that are currently visible within a month calendar control. You can send this message explicitly or by using the MonthCal_SetDayState macro.
MCM_SETFIRSTDAYOFWEEK
Sets the first day of the week for a month calendar control. You can send this message explicitly or by using the MonthCal_SetFirstDayOfWeek macro.
MCM_SETMAXSELCOUNT
Sets the maximum number of days that can be selected in a month calendar control. You can send this message explicitly or by using the MonthCal_SetMaxSelCount macro.
MCM_SETMONTHDELTA
Sets the scroll rate for a month calendar control. The scroll rate is the number of months that the control moves its display when the user clicks a scroll button. You can send this message explicitly or by using the MonthCal_SetMonthDelta macro.
MCM_SETRANGE
Sets the minimum and maximum allowable dates for a month calendar control. You can send this message explicitly or by using the MonthCal_SetRange macro.
MCM_SETSELRANGE
Sets the selection for a month calendar control to a given date range. You can send this message explicitly or by using the MonthCal_SetSelRange macro.
MCM_SETTODAY
Sets the "today" selection for a month calendar control. You can send this message explicitly or by using the MonthCal_SetToday macro.
MCM_SETUNICODEFORMAT
Sets the Unicode character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control. You can send this message explicitly or use the MonthCal_SetUnicodeFormat macro.
MCM_SIZERECTTOMIN
Calculates how many calendars will fit in the given rectangle, and then returns the minimum size that a rectangle needs to be to fit that number of calendars. You can send this message explicitly or by using the MonthCal_SizeRectToMin macro.
Notifications
MCN_GETDAYSTATE
Sent by a month calendar control to request information about how individual days should be displayed. This notification message is sent only by month calendar controls that use the MCS_DAYSTATE style, and it is sent in the form of a WM_NOTIFY message.
MCN_SELCHANGE
Sent by a month calendar control when the currently selected date or range of dates changes. This notification message is sent in the form of a WM_NOTIFY message.
MCN_SELECT
Sent by a month calendar control when the user makes an explicit date selection within a month calendar control. This notification is sent in the form of a WM_NOTIFY message.
MCN_VIEWCHANGE
Sent by a month calendar control when the current view changes. This notification message is sent in the form of a WM_NOTIFY message.
NM_RELEASEDCAPTURE (monthcal)
Notifies a monthcal control's parent window that the control is releasing mouse capture. This notification is sent in the form of a WM_NOTIFY message.
Structures
MCGRIDINFO
Contains information about part of a calendar control.
MCHITTESTINFO
Carries information specific to hit-testing points for a month calendar control. This structure is used with the MCM_HITTEST message and the corresponding MonthCal_HitTest macro.
NMDAYSTATE
Carries information required to process the MCN_GETDAYSTATE notification message. All members of this structure are for input, except
prgDayState, which the receiving application must set when processing MCN_GETDAYSTATE.
NMSELCHANGE
Carries information required to process the MCN_SELCHANGE notification message.
NMVIEWCHANGE
Stores information required to process the MCN_VIEWCHANGE notification message.
Constants
Month Calendar Control Data Types
This section contains information about the data types used with month calendar controls.
Month Calendar Control Styles
The following style constants are used when creating month calendar controls.