* Sync up to trunk HEAD (r62975).
[reactos.git] / dll / win32 / comctl32 / tooltips.c
index c1c9415..3589e28 100644 (file)
@@ -613,7 +613,7 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
     TOOLTIPS_CalcTipSize (infoPtr, &size);
     TRACE("size %d x %d\n", size.cx, size.cy);
 
-    if (track_activate)
+    if (track_activate && (toolPtr->uFlags & TTF_TRACK))
     {
         rect.left = infoPtr->xTrackPos;
         rect.top  = infoPtr->yTrackPos;
@@ -1024,6 +1024,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;
@@ -1047,27 +1050,29 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
     toolPtr->rect   = ti->rect;
     toolPtr->hinst  = ti->hinst;
 
-    if (IS_INTRESOURCE(ti->lpszText)) {
-       TRACE("add string id %x\n", LOWORD(ti->lpszText));
-       toolPtr->lpszText = ti->lpszText;
-    }
-    else if (ti->lpszText) {
-       if (TOOLTIPS_IsCallbackString(ti->lpszText, isW)) {
-           TRACE("add CALLBACK!\n");
-           toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
-       }
-       else if (isW) {
-           INT len = lstrlenW (ti->lpszText);
-           TRACE("add text %s!\n", debugstr_w(ti->lpszText));
-           toolPtr->lpszText = Alloc ((len + 1)*sizeof(WCHAR));
-           strcpyW (toolPtr->lpszText, ti->lpszText);
-       }
-       else {
-           INT len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, NULL, 0);
-           TRACE("add text \"%s\"!\n", (LPSTR)ti->lpszText);
-           toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
-           MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len);
-       }
+    if (ti->cbSize >= TTTOOLINFOW_V1_SIZE) {
+        if (IS_INTRESOURCE(ti->lpszText)) {
+            TRACE("add string id %x\n", LOWORD(ti->lpszText));
+            toolPtr->lpszText = ti->lpszText;
+        }
+        else if (ti->lpszText) {
+            if (TOOLTIPS_IsCallbackString(ti->lpszText, isW)) {
+                TRACE("add CALLBACK!\n");
+                toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
+            }
+            else if (isW) {
+                INT len = lstrlenW (ti->lpszText);
+                TRACE("add text %s!\n", debugstr_w(ti->lpszText));
+                toolPtr->lpszText =    Alloc ((len + 1)*sizeof(WCHAR));
+                strcpyW (toolPtr->lpszText, ti->lpszText);
+            }
+            else {
+                INT len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, NULL, 0);
+                TRACE("add text \"%s\"!\n", (LPSTR)ti->lpszText);
+                toolPtr->lpszText =    Alloc (len * sizeof(WCHAR));
+                MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len);
+            }
+        }
     }
 
     if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)