comctl32: TTM_ADDTOOLW must refuse to set a tooltip text to NULL.

This commit is contained in:
Francois Gouget 2013-11-29 18:55:36 +01:00 committed by Alexandre Julliard
parent 202d046d68
commit 542652deab
4 changed files with 32 additions and 23 deletions

View file

@ -700,10 +700,12 @@ STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
if (infoPtr->hwndToolTip) {
INT nTipCount;
TTTOOLINFOW ti;
WCHAR wEmpty = 0;
ZeroMemory (&ti, sizeof(TTTOOLINFOW));
ti.cbSize = sizeof(TTTOOLINFOW);
ti.hwnd = infoPtr->Self;
ti.lpszText = &wEmpty;
nTipCount = SendMessageW (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);
if (nTipCount < infoPtr->numParts) {

View file

@ -420,7 +420,7 @@ static void test_gettext(void)
toolinfoW.lParam = 0xdeadbeef;
GetClientRect(hwnd, &toolinfoW.rect);
r = SendMessageW(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW);
todo_wine ok(!r, "Adding the tool to the tooltip failed\n");
ok(!r, "Adding the tool to the tooltip succeeded!\n");
if (0) /* crashes on NT4 */
{

View file

@ -1037,6 +1037,9 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
infoPtr->hwndSelf, ti->hwnd, ti->uId,
(ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE && !ti->lpszText && isW)
return FALSE;
if (infoPtr->uNumTools == 0) {
infoPtr->tools = Alloc (sizeof(TTTOOL_INFO));
toolPtr = infoPtr->tools;
@ -1060,6 +1063,7 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
toolPtr->rect = ti->rect;
toolPtr->hinst = ti->hinst;
if (ti->cbSize >= TTTOOLINFOW_V1_SIZE) {
if (IS_INTRESOURCE(ti->lpszText)) {
TRACE("add string id %x\n", LOWORD(ti->lpszText));
toolPtr->lpszText = ti->lpszText;
@ -1082,6 +1086,7 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len);
}
}
}
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
toolPtr->lParam = ti->lParam;

View file

@ -1526,10 +1526,12 @@ TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
if (infoPtr->hwndToolTip) {
TTTOOLINFOW ti;
WCHAR wEmpty = 0;
ZeroMemory (&ti, sizeof(ti));
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE;
ti.hwnd = hwnd;
ti.lpszText = &wEmpty;
SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW, 0, (LPARAM)&ti);
}