Tooltips: Use Unicode Window Messages

Robert Shearman rob at codeweavers.com
Thu Sep 16 09:54:10 CDT 2004


Dmitry Timoshkov wrote:

>"Robert Shearman" <rob at codeweavers.com> wrote:
>  
>
>> static LRESULT
>> TOOLTIPS_OnWMGetText (HWND hwnd, WPARAM wParam, LPARAM lParam)
>> {
>>     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd);
>>+    LRESULT res;
>>+    LPWSTR pszText = (LPWSTR)lParam;
>> 
>>-    if(!infoPtr || !(infoPtr->szTipText))
>>+    if(!(infoPtr->szTipText))
>>         return 0;
>> 
>>-    return WideCharToMultiByte(CP_ACP, 0, infoPtr->szTipText, -1,
>>-        (LPSTR)lParam, wParam, NULL, NULL);
>>+    res = min(strlenW(infoPtr->szTipText)+1, wParam);
>>+    memcpy(pszText, infoPtr->szTipText, res*sizeof(WCHAR));
>>+    pszText[res-1] = '\0';
>>+    return res-1;
>>    
>>
>
>What happens if wParam == 0?
>
>  
>
The application will probably die a horrible death several functions 
away. I'll send another patch.

Rob




More information about the wine-devel mailing list