
This section contains information about the macros used with month calendar controls.
COLORREF MonthCal_GetColor(
HWND hwndMC,
INT iColor
);
Retrieves the color for a given portion of a month calendar control. You can use this macro or send the MCM_GETCOLOR message explicitly.
| 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
BOOL MonthCal_GetCurSel(
HWND hwndMC,
LPSYSTEMTIME lpSysTime
);
Retrieves the currently selected date. You can use this macro or send the MCM_GETCURSEL message explicitly.
Version 4.70
DWORD MonthCal_GetFirstDayOfWeek(
HWND hwndMC
);
Retrieves the first day of the week for a month calendar control. You can use this macro or send the MCM_GETFIRSTDAYOFWEEK message explicitly.
Version 4.70
DWORD MonthCal_GetMaxSelCount(
HWND hwndMC
);
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.
You can change the maximum date range that can be selected by using the MCM_SETMAXSELCOUNT message.
Version 4.70
DWORD MonthCal_GetMaxTodayWidth(
HWND hwndMC
);
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.
Version 4.70
BOOL MonthCal_GetMinReqRect(
HWND hwndMC,
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 use this macro or send the MCM_GETMINREQRECT message explicitly.
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
INT MonthCal_GetMonthDelta(
HWND hwndMC
);
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.
Version 4.70
DWORD MonthCal_GetMonthRange(
HWND hwndMC,
DWORD dwFlag,
LPSYSTEMTIME lprgSysTimeArray
);
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.
| 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
DWORD MonthCal_GetRange(
HWND hwndMC,
LPSYSTEMTIME lprgSysTimeArray
);
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.
| GDTR_MAX | There is a maximum limit set for the control; lprgSysTimeArray[0] is valid and contains the applicable date information. |
| GDTR_MIN | There is a minimum limit set for the control; lprgSysTimeArray[1] is valid and contains the applicable date information. |
Version 4.70
BOOL MonthCal_GetSelRange(
HWND hwndMC,
LPSYSTEMTIME lprgSysTimeArray
);
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.
Version 4.70
BOOL MonthCal_GetToday(
HWND hwndMC,
LPSYSTEMTIME lpToday
);
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.
Version 4.70
BOOL MonthCal_GetUnicodeFormat(
HWND hwnd
);
Retrieves the UNICODE character format flag for the control. You can use this macro or send the MCM_GETUNICODEFORMAT message explicitly.
See also MonthCal_SetUnicodeFormat
DWORD MonthCal_HitTest(
HWND hwndMC,
PMCHITTESTINFO pMCHitTest
);
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.
The uHit member of the MCHITTESTINFO structure at pMCHitTest will equal the return value.
Version 4.70
COLORREF MonthCal_SetColor(
HWND hwndMC,
INT iColor,
COLORREF clr
);
Sets the color for a given portion of a month calendar control. You can use this macro or send the MCM_SETCOLOR message explicitly.
| 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
BOOL MonthCal_SetCurSel(
HWND hwndMC,
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 use this macro or send the MCM_SETCURSEL message explicitly.
Version 4.70
BOOL MonthCal_SetDayState(
HWND hwndMC,
INT iMonths,
LPMONTHDAYSTATE lpDayStateArray
);
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.
The array at lpDayStateArray must contain as many elements as the value returned by the following macro:
MonthCal_GetMonthRange(hwndMC, GMR_DAYSTATE, NULL);
The preceding macro returns the total number of months that are in complete or partial view within the month calendar's display.
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
DWORD MonthCal_SetFirstDayOfWeek(
HWND hwndMC,
INT iDay
);
Sets the first day of the week for a month calendar control. You can use this macro or send the MCM_SETFIRSTDAYOFWEEK message explicitly.
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
BOOL MonthCal_SetMaxSelCount(
HWND hwndMC,
UINT iMax
);
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.
Version 4.70
INT MonthCal_SetMonthDelta(
HWND hwndMC,
INT iDelta
);
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.
Version 4.70
BOOL MonthCal_SetRange(
HWND hwndMC,
DWORD fWhichLimit,
LPSYSTEMTIME lprgSysTimeArray
);
Sets the minimum and maximum allowable dates for a month calendar control. You can use this macro or send the MCM_SETRANGE message explicitly.
| 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
BOOL MonthCal_SetSelRange(
HWND hwndMC,
LPSYSTEMTIME lprgSysTimeArray
);
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.
Version 4.70
void MonthCal_SetToday(
HWND hwndMC,
LPSYSTEMTIME lpSysTime
);
Sets the "today" selection for a month calendar control. You can use this macro or send the MCM_SETTODAY message explicitly.
If the "today" selection is set to any date other than the default, the following conditions apply:
Version 4.70
BOOL MonthCal_SetUnicodeFormat(
HWND hwnd,
BOOL fUnicode
);
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.
See also MonthCal_GetUnicodeFormat
This section contains information about the notification messages used with month calendar controls.
MCN_GETDAYSTATE
lpNMDayState = (LPNMDAYSTATE) lParam;
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.
Handling this notification message allows your application to customize its display by specifying that certain days be displayed in bold. For more information about processing this message, see Processing the MCN_GETDAYSTATE Notification Message.
Version 4.70
MCN_SELCHANGE
lpNMSelChange = (LPNMSELCHANGE) lParam;
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.
For example, the control sends MCN_SELCHANGE when the user explicitly changes his or her selection within the current month or when the selection is implicitly changed in response to next/previous month navigation.
This notification message is similar to MCN_SELECT, but it is sent in response to any selection change. MCN_SELECT is sent only for an explicit date selection.
Version 4.70
MCN_SELECT
lpNMSelChange = (LPNMSELCHANGE) lParam;
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.
This notification message is similar to MCN_SELCHANGE, but it is sent only in response to a user's explicit date selections. MCN_SELCHANGE applies to any selection change.
Version 4.70
NM_RELEASEDCAPTURE
lpnmh = (LPNMHDR) lParam;
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.
Version 4.71.
This section contains information about the structures used with month calendar controls.
typedef struct {
UINT cbSize;
POINT pt;
UINT uHit; // An output member
SYSTEMTIME st; // An output member
} MCHITTESTINFO, *PMCHITTESTINFO;
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.
| 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_NOWHERE | The given point was not on the month calendar control, or it was in an inactive portion of the control. |
| 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. |
Version 4.70
typedef struct tagNMDAYSTATE {
NMHDR nmhdr;
SYSTEMTIME stStart;
int cDayState;
LPMONTHDAYSTATE prgDayState;
} NMDAYSTATE, FAR * LPNMDAYSTATE;
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.
Version 4.70
typedef struct tagNMSELCHANGE{
NMHDR nmhdr;
SYSTEMTIME stSelStart;
SYSTEMTIME stSelEnd;
} NMSELCHANGE, FAR * LPNMSELCHANGE;
Carries information required to process the MCN_SELCHANGE notification message.
Version 4.70
This section contains information about the data types used with month calendar controls.
This is a new data type that is defined in Commctrl.h as follows:
typedef DWORD MONTHDAYSTATE, FAR * LPMONTHDAYSTATE;
The MONTHDAYSTATE type is a bit field, where each bit (1 through 31) represents the state of a day in a month. If a bit is on, the corresponding day will be displayed in bold; otherwise it will be displayed with no emphasis.
This data type is used with the MCM_SETDAYSTATE message and the corresponding macro, MonthCal_SetDayState. When MONTHDAYSTATE values are used in reference to months shorter than 31 days, only the needed bits will be accessed.
Version 4.70.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.