diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c index 724cba7bdeb..a7b433d8f61 100644 --- a/dlls/comctl32/datetime.c +++ b/dlls/comctl32/datetime.c @@ -1365,6 +1365,26 @@ DATETIME_Destroy (DATETIME_INFO *infoPtr) } +static INT +DATETIME_GetText (DATETIME_INFO *infoPtr, INT count, LPWSTR dst) +{ + WCHAR buf[80]; + int i; + + if (!dst || (count <= 0)) return 0; + + dst[0] = 0; + for (i = 0; i < infoPtr->nrFields; i++) + { + DATETIME_ReturnTxt(infoPtr, i, buf, sizeof(buf)/sizeof(buf[0])); + if ((strlenW(dst) + strlenW(buf)) < count) + strcatW(dst, buf); + else break; + } + return strlenW(dst); +} + + static LRESULT WINAPI DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -1476,6 +1496,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_GETFONT: return (LRESULT) infoPtr->hFont; + case WM_GETTEXT: + return (LRESULT) DATETIME_GetText(infoPtr, wParam, (LPWSTR)lParam); + case WM_SETTEXT: return CB_ERR; diff --git a/dlls/comctl32/tests/datetime.c b/dlls/comctl32/tests/datetime.c index 9218e07140e..a871930a576 100644 --- a/dlls/comctl32/tests/datetime.c +++ b/dlls/comctl32/tests/datetime.c @@ -197,7 +197,7 @@ static void test_dtm_set_format(void) r = SendMessage(hWnd, DTM_SETSYSTEMTIME, 0, (LPARAM)&systime); expect(1, r); GetWindowText(hWnd, txt, 256); - todo_wine ok(strcmp(txt, "hh 12") == 0, "String mismatch (\"%s\" vs \"hh 12\")\n", txt); + ok(strcmp(txt, "hh 12") == 0, "String mismatch (\"%s\" vs \"hh 12\")\n", txt); DestroyWindow(hWnd); } @@ -675,8 +675,7 @@ static void test_wm_set_get_text(void) ok(strcmp(buff, a_str) != 0, "Expected text not to change, got %s\n", buff); GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL, time, sizeof(time)); - todo_wine - ok(!strcmp(buff, time), "Expected %s, got %s\n", time, buff); + ok(!strcmp(buff, time), "Expected %s, got %s\n", time, buff); DestroyWindow(hWnd); }