
This section contains information about the following programming elements used with month calendar controls.
| Notifications |
| MCN_GETDAYSTATE |
| MCN_SELCHANGE |
| MCN_SELECT |
| NM_RELEASEDCAPTURE (monthcal) |
| Structures and Data Types |
| MCHITTESTINFO |
| MONTHDAYSTATE |
| NMDAYSTATE |
| NMSELCHANGE |
This section contains information about the constants used with month calendar controls.
The following are the styles used with month calendar controls.
| MCS_DAYSTATE | Version 4.70. The month calendar will send MCN_GETDAYSTATE notifications to request information about which days should be displayed in bold. For more information about supporting this style, see Processing the MCN_GETDAYSTATE Notification Message. |
| MCS_MULTISELECT | Version 4.70. The month calendar will allow the user to select a range of dates within the control. By default, the maximum range is one week. You can change the maximum range that can be selected by using the MCM_SETMAXSELCOUNT message. |
| MCS_NOTODAY | Version 4.70. The month calendar control will not display the "today" date at the bottom of the control. |
| MCS_NOTODAYCIRCLE | Version 4.70. The month calendar control will not circle the "today" date. |
| MCS_WEEKNUMBERS | Version 4.70. The month calendar control will display week numbers (1-52) to the left of each row of days. |
The following list contains the numeric representations of the days of the week that are used by the month calendar control.
| Value | Day of Week |
| 0 | Monday |
| 1 | Tuesday |
| 2 | Wednesday |
| 3 | Thursday |
| 4 | Friday |
| 5 | Saturday |
| 6 | Sunday |
This section contains information about the messages used with month calendar controls.
MCM_GETCOLOR
wParam = (WPARAM)(INT)iColor;
lParam = 0;
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.
| MCSC_BACKGROUND | Retrieve the background color displayed between months. |
| MCSC_MONTHBK | Retrieve the background color displayed within the month. |
| MCSC_TEXT | Retrieve the color used to display text within a month. |
| MCSC_TITLEBK | Retrieve the background color displayed in the calendar's title. |
| MCSC_TITLETEXT | Retrieve the color used to display text within the calendar's title. |
| MCSC_TRAILINGTEXT | Retrieve the color used to display header day and trailing day text. Header and trailing days are the days from the previous and following months that appear on the current month calendar. |
Version 4.70
MCM_GETCURSEL
wParam = 0;
lParam = (LPARAM) (LPSYSTEMTIME) lpSysTime;
Retrieves the currently selected date. You can send this message explicitly or by using the MonthCal_GetCurSel macro.
Version 4.70
See also Times in the Month Calendar Control
MCM_GETFIRSTDAYOFWEEK
wParam = 0;
lParam = 0;
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.
Version 4.70
MCM_GETMAXSELCOUNT
wParam = 0;
lParam = 0;
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.
You can change the maximum date range that can be selected by using the MCM_SETMAXSELCOUNT message.
Version 4.70
MCM_GETMAXTODAYWIDTH
wParam = 0;
lParam = 0;
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.
Version 4.70
MCM_GETMINREQRECT
wParam = 0;
lParam = (LPARAM) (LPRECT) lpRectInfo;
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 send this message explicitly or by using the MonthCal_GetMinReqRect macro.
The top and left members of lpRectInfo will always be zero. The right and bottom members represent the minimum cx and cy required for the control.
The minimum required window size for a month calendar control depends on the currently selected font.
Version 4.70
MCM_GETMONTHDELTA
wParam = 0;
lParam = 0;
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.
Version 4.70
MCM_GETMONTHRANGE
wParam = (WPARAM)(DWORD) dwFlag;
lParam = (LPARAM)(LPSYSTEMTIME) lprgSysTimeArray;
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.
| GMR_DAYSTATE | Include preceding and trailing months of visible range that are only partially displayed. |
| GMR_VISIBLE | Include only those months that are entirely displayed. |
Version 4.70
See also Times in the Month Calendar Control
MCM_GETRANGE
wParam = 0;
lParam = (LPARAM)(LPSYSTEMTIME) lprgSysTimeArray;
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.
| GDTR_MAX | A maximum limit is set for the control; lprgSysTimeArray[0] is valid and contains the applicable date information. |
| GDTR_MIN | A minimum limit is set for the control; lprgSysTimeArray[1] is valid and contains the applicable date information. |
Version 4.70
See also Times in the Month Calendar Control
MCM_GETSELRANGE
wParam = 0;
lParam = (LPARAM)(LPSYSTEMTIME) lprgSysTimeArray;
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.
Version 4.70
See also Times in the Month Calendar Control
MCM_GETTODAY
wParam = 0;
lParam = (LPARAM)(LPSYSTEMTIME) lpToday;
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.
Version 4.70
See also Times in the Month Calendar Control
MCM_GETUNICODEFORMAT
wParam = 0;
lParam = 0;
Retrieves the UNICODE character format flag for the control. You can send this message explicitly or use the MonthCal_GetUnicodeFormat macro.
See also MCM_SETUNICODEFORMAT
MCM_HITTEST
wParam = 0;
lParam = (LPARAM)(PMCHITTESTINFO) pMCHitTest;
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.
| MCHT_CALENDAR | The given point was within the calendar. |
| MCHT_CALENDARBK | The given point was in the calendar's background. |
| MCHT_CALENDARDATE | The given point was on a particular date within the calendar. The SYSTEMTIME structure at lpMCHitTest->st is set to the date at the given point. |
| MCHT_CALENDARDATENEXT | The given point was over a date from the next month (partially displayed at the end of the currently displayed month). If the user clicks here, the month calendar will scroll its display to the next month or set of months. |
| MCHT_CALENDARDATEPREV | The given point was over a date from the previous month (partially displayed at the end of the currently displayed month). If the user clicks here, the month calendar will scroll its display to the previous month or set of months. |
| MCHT_CALENDARDAY | The given point was over a day abbreviation ("Fri", for example). The SYSTEMTIME structure at lpMCHitTest->st is set to the corresponding date in the top row. |
| MCHT_CALENDARWEEKNUM | The given point was over a week number (MCS_WEEKNUMBERS style only). The SYSTEMTIME structure at lpMCHitTest->st is set to the corresponding date in the leftmost column. |
| MCHT_NEXT | The given point is in an area that will cause the month calendar to scroll its display to the next month or set of months. This flag is used to modify other hit test flags. |
| MCHT_NOWHERE | The given point was not on the month calendar control, or it was in an inactive portion of the control. |
| MCHT_PREV | The given point is in an area that will cause the month calendar to scroll its display to the previous month or set of months. This flag is used to modify other hit test flags. |
| MCHT_TITLE | The given point was over a month's title. |
| MCHT_TITLEBK | The given point was over the background of a month's title. |
| MCHT_TITLEBTNNEXT | The given point was over the button at the top right corner of the control. If the user clicks here, the month calendar will scroll its display to the next month or set of months. |
| MCHT_TITLEBTNPREV | The given point was over the button at the top left corner of the control. If the user clicks here, the month calendar will scroll its display to the previous month or set of months. |
| MCHT_TITLEMONTH | The given point was in a month's title bar, over a month name. |
| MCHT_TITLEYEAR | The given point was in a month's title bar, over the year value. |
| MCHT_TODAYLINK | The given point was on the "today" link at the bottom of the month calendar control. |
The uHit member of the MCHITTESTINFO structure at pMCHitTest will equal the return value.
Version 4.70
MCM_SETCOLOR
wParam = (WPARAM)(INT) iColor;
lParam = (LPARAM)(COLORREF) clr;
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.
| MCSC_BACKGROUND | Retrieve the background color displayed between months. |
| MCSC_MONTHBK | Retrieve the background color displayed within the month. |
| MCSC_TEXT | Retrieve the color used to display text within a month. |
| MCSC_TITLEBK | Retrieve the background color displayed in the calendar's title. |
| MCSC_TITLETEXT | Retrieve the color used to display text within the calendar's title. |
| MCSC_TRAILINGTEXT | Retrieve the color used to display header day and trailing day text. Header and trailing days are the days from the previous and following months that appear on the current month calendar. |
Version 4.70
MCM_SETCURSEL
wParam = 0;
lParam = (LPARAM)(LPSYSTEMTIME) lpSysTime;
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.
Version 4.70
See also Times in the Month Calendar Control
MCM_SETDAYSTATE
wParam = (WPARAM) iMonths;
lParam = (LPARAM)(LPMONTHDAYSTATE) lpDayStateArray;
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.
The array at lpDayStateArray must contain as many elements as the value returned by the following macro:
MonthCal_GetMonthRange(hwndMC, GMR_DAYSTATE, NULL);
Keep in mind that the array at lpDayStateArray must contain MONTHDAYSTATE values that correspond with all months currently in the control's display, in chronological order. This includes the two months only partially displayed before the first month and after the last month. For more information about preparing your array, see Preparing the MONTHDAYSTATE Array.
Version 4.70
MCM_SETFIRSTDAYOFWEEK
wParam = 0;
lParam = (LPARAM)(INT) iDay;
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.
If the first day of the week is set to anything other than the default (LOCALE_IFIRSTDAYOFWEEK), the control will not automatically update first-day-of-the-week changes based on locale changes.
Version 4.70
MCM_SETMAXSELCOUNT
wParam = (WPARAM)(INT) iMax;
lParam = 0;
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.
Version 4.70
MCM_SETMONTHDELTA
wParam = (WPARAM)(INT) iDelta;
lParam = 0;
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.
Version 4.70
MCM_SETRANGE
wParam = (WPARAM)(SHORT) fWhichLimit;
lParam = (LPARAM)(LPSYSTEMTIME) lprgSysTimeArray;
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.
| GDTR_MAX | The maximum allowable date is being set. The SYSTEMTIME structure at lprgSysTimeArray[1] must contain date information. |
| GDTR_MIN | The minimum allowable date is being set. The SYSTEMTIME structure at lprgSysTimeArray[0] must contain date information. |
Version 4.70
See also Times in the Month Calendar Control
MCM_SETSELRANGE
wParam = 0;
lParam = (LPARAM)(LPSYSTEMTIME) lprgSysTimeArray;
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.
Version 4.70
See also Times in the Month Calendar Control
MCM_SETTODAY
wParam = 0;
lParam = (LPARAM)(LPSYSTEMTIME) lpSysTime;
Sets the "today" selection for a month calendar control. You can send this message explicitly or by using the MonthCal_SetToday macro.
If the "today" selection is set to any date other than the default, the following conditions apply:
Version 4.70
See also Times in the Month Calendar Control
MCM_SETUNICODEFORMAT
wParam = (WPARAM)(BOOL)fUnicode;
lParam = 0;
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.
See also MCM_GETUNICODEFORMAT
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.