HeaderPane
Main
Hide
Share Link
Print

DisplayStart

Defines the first period a month calendar control shows.

C

BOOL WINAPI SftDate_GetDisplayStart(HWND hwndCtl, LPSYSTEMTIME lpValue);
BOOL WINAPI SftDate_SetDisplayStart(HWND hwndCtl, const SYSTEMTIME* lpValue);

C++

BOOL CSftCalendar::GetDisplayStart(LPSYSTEMTIME lpValue) const;
BOOL CSftCalendar::SetDisplayStart(const SYSTEMTIME* lpValue);

Parameters

hwndCtl

The window handle of the month calendar control (SftCalendar).

lpValue

GetDisplayStart: a pointer to a SYSTEMTIME structure that receives the first day of the first period shown.
SetDisplayStart: a pointer to a SYSTEMTIME structure that holds a day in the first period to show.

Returns

The return value is TRUE if successful, or FALSE if hwndCtl is not a month calendar control or lpValue is not a valid date.

Comments

The GetDisplayStart and SetDisplayStart functions define and retrieve the first period shown: in the month view the first month, in the year view the first year, in the decade and century views the first decade or century. GetDisplayStart returns the first day of that period. SetDisplayStart shows the period containing the date. A new month calendar control shows the period containing the current date first.

The control sends the NM_SFTDATE_DISPLAYCHANGED notification when the periods shown change. GetFirstDisplayedDate and GetLastDisplayedDate return the first and last day shown, including trailing days.

This function applies to the month calendar control only. For a date field control, GetDisplayStart returns FALSE and SetDisplayStart has no effect and returns FALSE.

SYSTEMTIME values are always Gregorian dates, regardless of the calendar system of the control's culture (SetCulture).

Examples

C View entire sample code

    case NM_SFTDATE_VIEWCHANGED: {
        int view = SftDate_GetView(lpnmhdr->hwndFrom);
        lpszCode = TEXT("NM_SFTDATE_VIEWCHANGED");
        lstrcpy(szValue, view >= 0 && view < 4 ? views[view] : TEXT("?"));
        break;
     }
    case NM_SFTDATE_DISPLAYCHANGED:
        lpszCode = TEXT("NM_SFTDATE_DISPLAYCHANGED");
        FormatDate(&st, SftDate_GetDisplayStart(lpnmhdr->hwndFrom, &st), szValue);
        break;
    case NM_SFTDATE_TODAYCLICKED:
        lpszCode = TEXT("NM_SFTDATE_TODAYCLICKED");
        break;
    case NM_SFTDATE_CLEARCLICKED:
        lpszCode = TEXT("NM_SFTDATE_CLEARCLICKED");
        break;

C++ View entire sample code

    case NM_SFTDATE_VIEWCHANGED: {
        int view = m_Calendar.GetView();
        code = _T("NM_SFTDATE_VIEWCHANGED");
        value = view >= 0 && view < 4 ? views[view] : _T("?");
        break;
     }
    case NM_SFTDATE_DISPLAYCHANGED:
        code = _T("NM_SFTDATE_DISPLAYCHANGED");
        value = FormatDate(st, m_Calendar.GetDisplayStart(&st));
        break;
    case NM_SFTDATE_TODAYCLICKED:
        code = _T("NM_SFTDATE_TODAYCLICKED");
        break;
    case NM_SFTDATE_CLEARCLICKED:
        code = _T("NM_SFTDATE_CLEARCLICKED");
        break;

See Also C/C++ API | Categories | Notifications


Last Updated 11/26/2026 - (email)
© 2026 Softel vdm, Inc.