comctl32: Implementation the WM_GETTEXT processing of datetime control

Nikolay Sivov bunglehead at gmail.com
Fri Nov 27 13:55:12 CST 2009


Ilya Shpigor wrote:
> +static INT
> +DATETIME_GetText (DATETIME_INFO *infoPtr, INT count, LPWSTR dst)
> +{
> +    WCHAR buf[80];
> +    int i;
> +
> +    if(!count) 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);
> +}
>   
I don't think it's a right way. You probably should use window text 
instead updating it on every change,
see how GetWindowText is implemented.
> @@ -674,6 +675,10 @@ static void test_wm_set_get_text(void)
>      ret = SendMessage(hWnd, WM_GETTEXT, sizeof(buff), (LPARAM)buff);
>      ok(strcmp(buff, a_str) != 0, "Expected text not to change, got %s\n", buff);
>  
> +    GetSystemTime(&stime);
> +    sprintf(time, "%d.%d.%d", stime.wDay, stime.wMonth, stime.wYear);
> +    ok(!strcmp(buff, time), "Expected %s, got %s\n", time, buff);
> +
>      DestroyWindow(hWnd);
>  }
>   
Test is definitely wrong. You can't expect DD.MMMM.YYYY pattern here, 
it's locale dependent.




More information about the wine-devel mailing list