diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c index 097e442078d..5cda4c07038 100644 --- a/dlls/comctl32/datetime.c +++ b/dlls/comctl32/datetime.c @@ -1399,6 +1399,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_GETFONT: return (LRESULT) infoPtr->hFont; + case WM_SETTEXT: + return CB_ERR; + default: if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", diff --git a/dlls/comctl32/tests/datetime.c b/dlls/comctl32/tests/datetime.c index a0f12f07756..7cd08a02860 100644 --- a/dlls/comctl32/tests/datetime.c +++ b/dlls/comctl32/tests/datetime.c @@ -668,6 +668,25 @@ static void test_dtm_set_and_get_system_time(void) DestroyWindow(hWnd); } +static void test_wm_set_get_text(void) +{ + static const CHAR a_str[] = "a"; + char buff[10]; + HWND hWnd; + LRESULT ret; + + hWnd = create_datetime_control(0); + + ret = SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)a_str); + expect(CB_ERR, ret); + + buff[0] = 0; + ret = SendMessage(hWnd, WM_GETTEXT, sizeof(buff), (LPARAM)buff); + ok(strcmp(buff, a_str) != 0, "Expected text not to change, got %s\n", buff); + + DestroyWindow(hWnd); +} + START_TEST(datetime) { HMODULE hComctl32; @@ -694,4 +713,5 @@ START_TEST(datetime) test_dtm_set_and_get_range(); test_dtm_set_range_swap_min_max(); test_dtm_set_and_get_system_time(); + test_wm_set_get_text(); }