The SFTDATE_SPECIALDATE structure describes a special date, a day a calendar shows differently, such as a holiday or an appointment.
typedef struct tagSftDateSpecialDate {
int cbSize;
SYSTEMTIME date;
int recurrence;
BOOL fBold;
COLORREF colorBg;
COLORREF colorFg;
SFT_PICTURE Picture;
LPCTSTR lpszToolTip;
BOOL fEnabled;
LPARAM lParam;
} SFTDATE_SPECIALDATE, * LPSFTDATE_SPECIALDATE;
typedef const SFTDATE_SPECIALDATE * LPCSFTDATE_SPECIALDATE;The size of the structure, sizeof(SFTDATE_SPECIALDATE). It must be set before the structure is passed to a function.
The date. The time is ignored. SYSTEMTIME values are always Gregorian dates.
Defines whether the special date repeats, one of the following values:
| SFTDATE_RECURRENCE_NONE | The date only. |
| SFTDATE_RECURRENCE_WEEKLY | The same day of every week. |
| SFTDATE_RECURRENCE_MONTHLY | The same day of every month. |
| SFTDATE_RECURRENCE_ANNUALLY | The same day and month of every year. |
TRUE to show the day in bold, which is how special dates are usually shown.
The background color of the day, or SFTDATE_NOCOLOR for none.
The text color of the day, or SFTDATE_NOCOLOR for the default color.
A picture shown in the top corner of the day (see SFT_PICTURE), for example a color sample created using Sft_SetPictureColorSample or a GDI+ image. A zero-filled structure shows no picture.
The tooltip shown when the mouse rests on the day, also announced by screen readers, or NULL for none.
TRUE if the day can be selected, FALSE to show it disabled.
Application-defined data.
The SFTDATE_SPECIALDATE structure is used with AddSpecialDate, InsertSpecialDate, GetSpecialDate and SetSpecialDate. An application initializes all members, usually with memset first; fBold and fEnabled are normally TRUE.
Monthly and annual recurrences use the calendar system of the control's culture (SetCulture): an annual special date in a Hebrew calendar repeats on the same Hebrew day and month. Recurring special dates also apply to the years before date.
The control copies the structure and the tooltip text. The picture is not copied: the bitmap, icon, image list or GDI+ image it refers to must remain valid as long as the special date exists. Colors can be RGB values or GetSysColor index values with the high-order bit set (e.g., COLOR_WINDOW | 0x80000000L); RGB values are used as given in dark mode too.
The application can change the formatting of any day in the NM_SFTDATE_DAYFORMATTING notification, which receives the formatting of the special date that applies.
SFTDATE_SPECIALDATE sd;
memset(&sd, 0, sizeof(sd));
sd.cbSize = sizeof(sd);
sd.date.wYear = 2026; sd.date.wMonth = 12; sd.date.wDay = 25;
sd.recurrence = SFTDATE_RECURRENCE_ANNUALLY;
sd.fBold = TRUE;
sd.fEnabled = TRUE;
sd.colorFg = RGB(178, 34, 34);
sd.lpszToolTip = TEXT("Christmas Day");
SftDate_AddSpecialDate(hwndCalendar, &sd);/**********************************************************************/ /* Options */ /**********************************************************************/ // Special dates repeat every year, month or week, and can be bold, colored, disabled, show a picture and a tooltip. static void SetHolidays(HWND controls[CONTROLS], BOOL fShow) { SFTDATE_SPECIALDATE days[5]; SYSTEMTIME today, monday; int i, d; GetLocalTime(&today); monday = AddDays(&today, -((today.wDayOfWeek + 6) % 7)); memset(days, 0, sizeof(days)); for (d = 0; d < 5; ++d) {
// Special dates repeat every year, month or week, and can be bold, colored, disabled, show a picture and a tooltip. void CMainDlg::SetHolidays(BOOL fShow) { SYSTEMTIME today; GetLocalTime(&today); SYSTEMTIME monday = AddDays(today, -((today.wDayOfWeek + 6) % 7)); SFTDATE_SPECIALDATE days[5]; memset(days, 0, sizeof(days)); for (int d = 0; d < 5; ++d) { days[d].cbSize = sizeof(SFTDATE_SPECIALDATE); days[d].recurrence = SFTDATE_RECURRENCE_ANNUALLY; days[d].fBold = TRUE; days[d].colorBg = SFTDATE_NOCOLOR; days[d].colorFg = RGB(178, 34, 34); days[d].fEnabled = TRUE;
See Also C/C++ API | Categories | Notifications