Month Calendar – Giavapps Windows API

 

 

api_monthcalendar_create(ParentHandle, X, Y, W, H, Flags, ExFlags) This function creates a month calendar control.

ParentHandle: parent handle.
X: x coordinate.
Y: y coordinate.
W: width.
H: height.
Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".

 

Flags

 

This control supports the Window Styles and you can specify any of the styles listed below:

 

MCS_DAYSTATE The month calendar sends notifications to request information about which days should be displayed in bold.

MCS_MULTISELECT The month calendar enables the user to select a range of dates within the control. By default, the maximum range is one week.

MCS_WEEKNUMBERS The month calendar control displays week numbers (1-52) to the left of each row of days. Week 1 is defined as the first week that contains at least four days.

MCS_NOTODAYCIRCLE The month calendar control does not circle the "today" date.

MCS_NOTODAY The month calendar control does not display the "today" date at the bottom of the control.

 

Extended Flags

 

This control supports the Extended Window Styles.

 

Return Value

 

If the function succeeds, the return value is a handle to the new month calendar control.

If the function fails, the return value is false.

To get extended error information, call api_control_get_last_error().

 

Control Functions

 

api_monthcalendar_set_selection(MonthCalendarHandle, Day, Month, Year) 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. The function returns true if successful, or false otherwise. This function will fail if applied to a month calendar control that uses the MCS_MULTISELECT style.

MonthCalendarHandle: it must be a MonthCalendarHandle.
Day: the day number (1-31).
Month: the month number (1-12).
Year: the year number.

 

api_monthcalendar_get_selection(MonthCalendarHandle,DateFlag) Retrieves the currently selected date. This function will always fail when applied to month calendar controls that are set to the MCS_MULTISELECT style.

MonthCalendarHandle: it must be a MonthCalendarHandle.
DateFlag: identifies the type of date information to retrieve.

You can specify as DateFlag argument one of the following flags:

MCD_DAYOFWEEK Returns the day of the week (0-6).

MCD_DAY Returns the day number (1-31).

MCD_MONTH Returns the month number (1-12).

MCD_YEAR Returns the year number.

 

api_monthcalendar_set_multi_selection(MonthCalendarHandle, FromDay, FromMonth, FromYear, ToDay, ToMonth, ToYear) Sets the selection for a month calendar control to a given date range. The function returns true if successful, or false otherwise. This function will fail if applied to a month calendar control that does not use the MCS_MULTISELECT style.

MonthCalendarHandle: it must be a MonthCalendarHandle.
FromDay: the day number (1-31) to select from.
FromMonth: the month number (1-12) to select from.
FromYear: the year number to select from.
ToDay: the day number (1-31) to select to.
ToMonth: the month number (1-12) to select to.
ToYear: the year number to select to.

 

api_monthcalendar_get_multi_selection(MonthCalendarHandle, DateFlag, FirstOrLast) Returns date information that represents the upper and lower limits of the date range currently selected by the user. This function will fail if applied to a month calendar control that does not use the MCS_MULTISELECT style.

MonthCalendarHandle: it must be a MonthCalendarHandle.
DateFlag: identifies the type of date information to retrieve.
FirstOrLast: retrieves the first (false) or last (true) selection.

You can specify as DateFlag argument one of the following flags:

MCD_DAYOFWEEK Returns the day of the week (0-6).

MCD_DAY Returns the day number (1-31).

MCD_MONTH Returns the month number (1-12).

MCD_YEAR Returns the year number.

 

api_monthcalendar_set_maximum_selection(MonthCalendarHandle, MaximumDays) Sets the maximum number of days that can be selected in a multi-selection month calendar control. Returns true if successful, or false otherwise.

MonthCalendarHandle: it must be a MonthCalendarHandle.
MaximumDays: maximum number of days that can be selected in the specified multi-selection month calendar control.

 

api_multicalendar_get_maximum_selection(MonthCalendarHandle) Returns the maximum number of days that can be selected in a multi-selection month calendar control.

MonthCalendarHandle: it must be a MonthCalendarHandle.

 

api_monthcalendar_set_today(MonthCalendarHandle, Day, Month, Year) Sets the "today" selection for a month calendar control.

MonthCalendarHandle: it must be a MonthCalendarHandle.
Day: the day number (1-31).
Month: the month number (1-12).
Year: the year number.

 

api_monthcalendar_get_today(MonthCalendarHandle, DateFlag) Returns the date information for the date specified as "today" for a month calendar control.

MonthCalendarHandle: it must be a MonthCalendarHandle.
DateFlag: identifies the type of date information to retrieve.

You can specify as DateFlag argument one of the following flags:

MCD_DAYOFWEEK Returns the day of the week (0-6).

MCD_DAY Returns the day number (1-31).

MCD_MONTH Returns the month number (1-12).

MCD_YEAR Returns the year number.

 

api_monthcalendar_set_range(MonthCalendarHandle, FromDay, FromMonth, FromYear, ToDay, ToMonth, ToYear) Sets the minimum and maximum allowable dates for a month calendar control.

MonthCalendarHandle: it must be a MonthCalendarHandle.
FromDay: the minimum day number (1-31).
FromMonth: the minimum month number (1-12).
FromYear: the minimum year number.
ToDay: the maximum day number (1-31).
ToMonth: the maximum month number (1-12).
ToYear: the maximum year number.

 

api_monthcalendar_get_range(MonthCalendarHandle, DateFlag, MinimumOrMaximum) Returns the minimum and maximum allowable dates set for a month calendar control.

MonthCalendarHandle: it must be a MonthCalendarHandle.
DateFlag: identifies the type of date information to retrieve.
MinimumOrMaximum: retrieves the minimum (false) or maximum (true) date.

You can specify as DateFlag argument one of the following flags:

MCD_DAYOFWEEK Returns the day of the week (0-6).

MCD_DAY Returns the day number (1-31).

MCD_MONTH Returns the month number (1-12).

MCD_YEAR Returns the year number.

 

Code Examples

 

Creating a Month Calendar Control

 

monthcalendar = api_monthcalendar_create(window,10,10,225,160,WS_VISIBLE | WS_CHILD,0);

 

Setting Today Selection

 

api_monthcalendar_set_today(monthcalendar,19,8,2015);

 

Checking Today Selection

 

if(api_monthcalendar_get_today(monthcalendar,MCD_DAY) == 19 && api_monthcalendar_get_today(monthcalendar,MCD_MONTH) == 8)
{
api_messagebox(window,"Happy Birthday DJ Gi!","HAPPY BIRTHDAY!",MB_OK);
}

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*