diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index b23a990c8cc..0d4c96b2ea2 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1872,25 +1872,23 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) infoPtr->firstDayHighWord = FALSE; MONTHCAL_SetFirstDayOfWeek(infoPtr, -1); infoPtr->currentMonth = infoPtr->todaysDate.wMonth; - infoPtr->currentYear = infoPtr->todaysDate.wYear; + infoPtr->currentYear = infoPtr->todaysDate.wYear; infoPtr->minDate = infoPtr->todaysDate; infoPtr->maxDate = infoPtr->todaysDate; - infoPtr->maxDate.wYear=2050; - infoPtr->minDate.wYear=1950; - infoPtr->maxSelCount = 7; - infoPtr->monthRange = 3; - infoPtr->monthdayState = Alloc - (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); - infoPtr->titlebk = comctl32_color.clrActiveCaption; - infoPtr->titletxt = comctl32_color.clrWindow; - infoPtr->monthbk = comctl32_color.clrWindow; - infoPtr->trailingtxt = comctl32_color.clrGrayText; - infoPtr->bk = comctl32_color.clrWindow; - infoPtr->txt = comctl32_color.clrWindowText; + infoPtr->maxDate.wYear = 2050; + infoPtr->minDate.wYear = 1950; + infoPtr->maxSelCount = 7; + infoPtr->monthRange = 3; + infoPtr->monthdayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); + infoPtr->titlebk = comctl32_color.clrActiveCaption; + infoPtr->titletxt = comctl32_color.clrWindow; + infoPtr->monthbk = comctl32_color.clrWindow; + infoPtr->trailingtxt = comctl32_color.clrGrayText; + infoPtr->bk = comctl32_color.clrWindow; + infoPtr->txt = comctl32_color.clrWindowText; - /* set the current day for highlighing */ - infoPtr->minSel.wDay = infoPtr->todaysDate.wDay; - infoPtr->maxSel.wDay = infoPtr->todaysDate.wDay; + infoPtr->minSel = infoPtr->todaysDate; + infoPtr->maxSel = infoPtr->todaysDate; /* call MONTHCAL_UpdateSize to set all of the dimensions */ /* of the control */ diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 32b4d148a93..8cd34945c74 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -1237,6 +1237,41 @@ static void test_monthcal_destroy(void) ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_multi_sel_style_seq, "Destroy monthcal (multi sel style)", FALSE); } +static void test_monthcal_getselrange(void) +{ + HWND hwnd; + SYSTEMTIME st, range[2]; + BOOL ret; + + hwnd = create_monthcal_control(MCS_MULTISELECT); + + /* just after creation selection should start and end today */ + ret = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st); + expect(TRUE, ret); + + ret = SendMessage(hwnd, MCM_GETSELRANGE, 0, (LPARAM)range); + expect(TRUE, ret); + expect(st.wYear, range[0].wYear); + expect(st.wMonth, range[0].wMonth); + expect(st.wDay, range[0].wDay); + expect(st.wDayOfWeek, range[0].wDayOfWeek); + expect(st.wHour, range[0].wHour); + expect(st.wMinute, range[0].wMinute); + expect(st.wSecond, range[0].wSecond); + expect(st.wMilliseconds, range[0].wMilliseconds); + + expect(st.wYear, range[1].wYear); + expect(st.wMonth, range[1].wMonth); + expect(st.wDay, range[1].wDay); + expect(st.wDayOfWeek, range[1].wDayOfWeek); + expect(st.wHour, range[1].wHour); + expect(st.wMinute, range[1].wMinute); + expect(st.wSecond, range[1].wSecond); + expect(st.wMilliseconds, range[1].wMilliseconds); + + DestroyWindow(hwnd); +} + START_TEST(monthcal) { HMODULE hComctl32; @@ -1273,6 +1308,7 @@ START_TEST(monthcal) test_monthcal_todaylink(); test_monthcal_size(); test_monthcal_maxselday(); + test_monthcal_getselrange(); flush_sequences(sequences, NUM_MSG_SEQUENCES); DestroyWindow(parent_wnd);