comctl32: Implementation the WM_GETTEXT processing of datetime control.

This commit is contained in:
Ilya Shpigor 2009-12-02 11:20:05 +03:00 committed by Alexandre Julliard
parent b402b78780
commit fa92edfa48
2 changed files with 25 additions and 3 deletions

View file

@ -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;

View file

@ -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);
}