Index: trunk/src/comctl32/header.c
===================================================================
--- trunk/src/comctl32/header.c	(revision 250)
+++ trunk/src/comctl32/header.c	(revision 252)
@@ -1,3 +1,3 @@
-/* $Id: header.c,v 1.6 1999-06-28 15:46:24 cbratschi Exp $ */
+/* $Id: header.c,v 1.7 1999-06-30 15:52:16 cbratschi Exp $ */
 /*
  *  Header control
@@ -598,5 +598,5 @@
     if (phdi->mask & HDI_TEXT) {
         if (lpItem->pszText != LPSTR_TEXTCALLBACKW)
-            lstrcpynWtoA (phdi->pszText, lpItem->pszText, MIN(phdi->cchTextMax,lstrlenW(lpItem->pszText)));
+            lstrcpynWtoA (phdi->pszText, lpItem->pszText, phdi->cchTextMax);
         else
             phdi->pszText = LPSTR_TEXTCALLBACKA;
@@ -646,5 +646,5 @@
     if (phdi->mask & HDI_TEXT) {
         if (lpItem->pszText != LPSTR_TEXTCALLBACKW)
-            lstrcpynW (phdi->pszText, lpItem->pszText, MIN(phdi->cchTextMax,lstrlenW(lpItem->pszText)));
+            lstrcpynW (phdi->pszText, lpItem->pszText, phdi->cchTextMax);
         else
             phdi->pszText = LPSTR_TEXTCALLBACKW;
Index: trunk/src/comctl32/listview.c
===================================================================
--- trunk/src/comctl32/listview.c	(revision 250)
+++ trunk/src/comctl32/listview.c	(revision 252)
@@ -3060,5 +3060,5 @@
       if ((lpColumn->mask & LVCF_TEXT) && (lpColumn->pszText) && (hdi.pszText))
       {
-        lstrcpynA (lpColumn->pszText, hdi.pszText, MIN(lpColumn->cchTextMax,lstrlenA(hdi.pszText)));
+        lstrcpynA (lpColumn->pszText, hdi.pszText, lpColumn->cchTextMax);
       }
 
Index: trunk/src/comctl32/rebar.c
===================================================================
--- trunk/src/comctl32/rebar.c	(revision 250)
+++ trunk/src/comctl32/rebar.c	(revision 252)
@@ -1,3 +1,3 @@
-/* $Id: rebar.c,v 1.5 1999-06-28 15:46:26 cbratschi Exp $ */
+/* $Id: rebar.c,v 1.6 1999-06-30 15:52:17 cbratschi Exp $ */
 /*
  * Rebar control
@@ -640,5 +640,5 @@
     if ((lprbbi->fMask & RBBIM_TEXT) &&
         (lprbbi->lpText) && (lpBand->lpText)) {
-            lstrcpynWtoA (lprbbi->lpText, lpBand->lpText, MIN(lprbbi->cch,lstrlenW(lpBand->lpText)));
+            lstrcpynWtoA (lprbbi->lpText, lpBand->lpText,lprbbi->cch);
     }
 
@@ -711,5 +711,5 @@
     if ((lprbbi->fMask & RBBIM_TEXT) &&
         (lprbbi->lpText) && (lpBand->lpText)) {
-            lstrcpynW (lprbbi->lpText, lpBand->lpText, MIN(lprbbi->cch,lstrlenW(lpBand->lpText)));
+            lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
     }
 
Index: trunk/src/comctl32/status.c
===================================================================
--- trunk/src/comctl32/status.c	(revision 250)
+++ trunk/src/comctl32/status.c	(revision 252)
@@ -1,3 +1,3 @@
-/* $Id: status.c,v 1.6 1999-06-28 15:46:26 cbratschi Exp $ */
+/* $Id: status.c,v 1.7 1999-06-30 15:52:17 cbratschi Exp $ */
 /*
  * Interface code to StatusWindow widget/control
@@ -441,5 +441,5 @@
 
         if (ti.lpszText)
-            lstrcpynA ((LPSTR)lParam, ti.lpszText, MIN(HIWORD(wParam),lstrlenA(ti.lpszText)));
+            lstrcpynA ((LPSTR)lParam, ti.lpszText, HIWORD(wParam));
     }
 
@@ -461,5 +461,5 @@
 
         if (ti.lpszText)
-            lstrcpynW ((LPWSTR)lParam, ti.lpszText, MIN(HIWORD(wParam),lstrlenW(ti.lpszText)));
+            lstrcpynW ((LPWSTR)lParam, ti.lpszText, HIWORD(wParam));
     }
 
Index: trunk/src/comctl32/tab.c
===================================================================
--- trunk/src/comctl32/tab.c	(revision 250)
+++ trunk/src/comctl32/tab.c	(revision 252)
@@ -1,3 +1,3 @@
-/* $Id: tab.c,v 1.6 1999-06-28 15:46:26 cbratschi Exp $ */
+/* $Id: tab.c,v 1.7 1999-06-30 15:52:17 cbratschi Exp $ */
 /*
  * Tab control
@@ -1354,5 +1354,5 @@
    if (len>wineItem->cchTextMax)
      wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, len+1);
-   lstrcpynA (wineItem->pszText, tabItem->pszText, len);
+   lstrcpynA (wineItem->pszText, tabItem->pszText, len+1);
   }
 
Index: trunk/src/comctl32/toolbar.c
===================================================================
--- trunk/src/comctl32/toolbar.c	(revision 250)
+++ trunk/src/comctl32/toolbar.c	(revision 252)
@@ -1,3 +1,3 @@
-/* $Id: toolbar.c,v 1.7 1999-06-28 15:46:27 cbratschi Exp $ */
+/* $Id: toolbar.c,v 1.8 1999-06-30 15:52:18 cbratschi Exp $ */
 /*
  * Toolbar control
@@ -1518,5 +1518,5 @@
             lstrcpynA (lpTbInfo->pszText,
                          (LPSTR)infoPtr->strings[btnPtr->iString],
-                         MIN(lpTbInfo->cchText,lstrlenA((LPSTR)infoPtr->strings[btnPtr->iString])));
+                         lpTbInfo->cchText);
     }
 
Index: trunk/src/comctl32/tooltips.c
===================================================================
--- trunk/src/comctl32/tooltips.c	(revision 250)
+++ trunk/src/comctl32/tooltips.c	(revision 252)
@@ -1,3 +1,3 @@
-/* $Id: tooltips.c,v 1.8 1999-06-28 15:46:27 cbratschi Exp $ */
+/* $Id: tooltips.c,v 1.9 1999-06-30 15:52:18 cbratschi Exp $ */
 /*
  * Tool tip control
@@ -8,5 +8,4 @@
  *
  * TODO:
- *   - Unicode support.
  *   - Custom draw support.
  *
@@ -20,4 +19,5 @@
 /* CB: Odin32 problems
  - WM_NCCREATE not handled first -> title bar visible if WS_POPUP wasn't set before
+ - CS_SAVEBITS: window movements are slow, bug in Open32?
 */
 
@@ -117,5 +117,5 @@
         } else if (ttnmdi.szText[0])
         {
-          lstrcpynAtoW(infoPtr->szTipText,ttnmdi.szText,MIN(INFOTIPSIZE-1,lstrlenA(ttnmdi.szText)));
+          lstrcpynAtoW(infoPtr->szTipText,ttnmdi.szText,INFOTIPSIZE);
           if (ttnmdi.uFlags & TTF_DI_SETITEM)
           {
@@ -131,5 +131,5 @@
         } else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA)
         {
-          lstrcpynAtoW(infoPtr->szTipText,ttnmdi.lpszText,MIN(INFOTIPSIZE-1,lstrlenA(ttnmdi.lpszText)));
+          lstrcpynAtoW(infoPtr->szTipText,ttnmdi.lpszText,INFOTIPSIZE);
           if (ttnmdi.uFlags & TTF_DI_SETITEM)
           {
@@ -147,5 +147,5 @@
       {
         /* the item is a usual (unicode) text */
-        lstrcpynW(infoPtr->szTipText,toolPtr->lpszText,MIN(INFOTIPSIZE-1,lstrlenW(toolPtr->lpszText)));
+        lstrcpynW(infoPtr->szTipText,toolPtr->lpszText,INFOTIPSIZE);
       }
     }
@@ -160,5 +160,5 @@
 
 static VOID
-TOOLTIPS_CalcTipSize (HWND hwnd,TOOLTIPS_INFO *infoPtr,LPSIZE lpSize)
+TOOLTIPS_CalcTipRect (HWND hwnd,TOOLTIPS_INFO *infoPtr,TTTOOL_INFO *toolPtr,LPRECT lpRect)
 {
     HDC hdc;
@@ -166,4 +166,5 @@
     UINT uFlags = DT_EXTERNALLEADING | DT_CALCRECT;
     RECT rc = {0,0,0,0};
+    SIZE size;
 
     if (infoPtr->nMaxTipWidth > -1)
@@ -181,164 +182,18 @@
     ReleaseDC(hwnd,hdc);
 
-    lpSize->cx = rc.right-rc.left+4+infoPtr->rcMargin.left+infoPtr->rcMargin.right;
-    lpSize->cy = rc.bottom-rc.top+4+infoPtr->rcMargin.bottom+infoPtr->rcMargin.top;
-}
-
-
-static VOID
-TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
-{
-    TTTOOL_INFO *toolPtr;
-    RECT rect;
-    SIZE size;
-    HDC  hdc;
-    NMHDR  hdr;
-
-    if (infoPtr->nTool == -1)
-    {
-//      TRACE (tooltips, "invalid tool (-1)!\n");
-        return;
-    }
-
-    infoPtr->nCurrentTool = infoPtr->nTool;
-
-//    TRACE (tooltips, "Show tooltip pre %d!\n", infoPtr->nTool);
-    TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nCurrentTool);
-
-    if (infoPtr->szTipText[0] == '\0')
-    {
-        infoPtr->nCurrentTool = -1;
-        return;
-    }
-
-//    TRACE (tooltips, "Show tooltip %d!\n", infoPtr->nCurrentTool);
-    toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
-
-    hdr.hwndFrom = hwnd;
-    hdr.idFrom = toolPtr->uId;
-    hdr.code = TTN_SHOW;
-    SendMessageA(toolPtr->hwnd,WM_NOTIFY,
-                    (WPARAM)toolPtr->uId,(LPARAM)&hdr);
-
-//    TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
-
-    TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
-//    TRACE (tooltips, "size %d - %d\n", size.cx, size.cy);
-
-    if (toolPtr->uFlags & TTF_CENTERTIP)
-    {
-        RECT rc;
-
-        if (toolPtr->uFlags & TTF_IDISHWND)
-            GetWindowRect ((HWND)toolPtr->uId, &rc);
-        else
-        {
-            rc = toolPtr->rect;
-            MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2);
-        }
-        rect.left = (rc.left + rc.right - size.cx) / 2;
-        rect.top  = rc.bottom + 2;
-    } else
-    {
-        GetCursorPos((LPPOINT)&rect);
-        rect.top += 20;
-    }
-
-    /* FIXME: check position */
-
-//    TRACE (tooltips, "pos %d - %d\n", rect.left, rect.top);
-
-    rect.right = rect.left + size.cx;
-    rect.bottom = rect.top + size.cy;
-
-    AdjustWindowRectEx (&rect,GetWindowLongA(hwnd, GWL_STYLE),
-                        FALSE,GetWindowLongA(hwnd, GWL_EXSTYLE));
-
-    SetWindowPos (hwnd,HWND_TOP,rect.left,rect.top,
-                    rect.right-rect.left,rect.bottom-rect.top,
-                    SWP_SHOWWINDOW | SWP_NOACTIVATE);
-
-    /* repaint the tooltip */
-    hdc = GetDC(hwnd);
-    TOOLTIPS_Refresh(hwnd,hdc);
-    ReleaseDC(hwnd,hdc);
-
-    SetTimer (hwnd,ID_TIMERPOP,infoPtr->nAutoPopTime,0);
-}
-
-
-static VOID
-TOOLTIPS_Hide (HWND hwnd, TOOLTIPS_INFO *infoPtr)
-{
-    TTTOOL_INFO *toolPtr;
-    NMHDR hdr;
-
-    if (infoPtr->nCurrentTool == -1)
-        return;
-
-    toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
-//    TRACE (tooltips, "Hide tooltip %d!\n", infoPtr->nCurrentTool);
-    KillTimer (hwnd, ID_TIMERPOP);
-
-    hdr.hwndFrom = hwnd;
-    hdr.idFrom = toolPtr->uId;
-    hdr.code = TTN_POP;
-    SendMessageA (toolPtr->hwnd, WM_NOTIFY,
-                    (WPARAM)toolPtr->uId, (LPARAM)&hdr);
-
-    infoPtr->nCurrentTool = -1;
-
-    SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
-                    SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
-}
-
-
-static VOID
-TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr)
-{
-    TTTOOL_INFO *toolPtr;
-    RECT rect;
-    SIZE size;
-    HDC  hdc;
-    NMHDR hdr;
-
-    if (infoPtr->nTrackTool == -1)
-    {
-//    TRACE (tooltips, "invalid tracking tool (-1)!\n");
-      return;
-    }
-
-//    TRACE (tooltips, "show tracking tooltip pre %d!\n", infoPtr->nTrackTool);
-
-    TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nTrackTool);
-
-    if (infoPtr->szTipText[0] == '\0')
-    {
-      infoPtr->nTrackTool = -1;
-      return;
-    }
-
-//    TRACE (tooltips, "show tracking tooltip %d!\n", infoPtr->nTrackTool);
-    toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
-
-    hdr.hwndFrom = hwnd;
-    hdr.idFrom = toolPtr->uId;
-    hdr.code = TTN_SHOW;
-    SendMessageA(toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&hdr);
-
-//    TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
-
-    TOOLTIPS_CalcTipSize(hwnd,infoPtr,&size);
-//    TRACE (tooltips, "size %d - %d\n", size.cx, size.cy);
+    size.cx = rc.right-rc.left+4+infoPtr->rcMargin.left+infoPtr->rcMargin.right;
+    size.cy = rc.bottom-rc.top+4+infoPtr->rcMargin.bottom+infoPtr->rcMargin.top;
+
+    //CB: optimize
 
     if (toolPtr->uFlags & TTF_ABSOLUTE)
     {
-      rect.left = infoPtr->xTrackPos;
-      rect.top  = infoPtr->yTrackPos;
+      rc.left = infoPtr->xTrackPos;
+      rc.top  = infoPtr->yTrackPos;
 
       if (toolPtr->uFlags & TTF_CENTERTIP)
       {
-        rect.left -= (size.cx/2);
-        rect.top  -= (size.cy/2);
+        rc.left -= (size.cx/2);
+        rc.top  -= (size.cy/2);
       }
     } else
@@ -355,26 +210,158 @@
       }
 
-      GetCursorPos ((LPPOINT)&rect);
-      rect.top += 20;
-
       if (toolPtr->uFlags & TTF_CENTERTIP)
       {
-        rect.left -= (size.cx / 2);
-        rect.top  -= (size.cy / 2);
+        if (infoPtr->bTrackActive)
+        {
+          GetCursorPos((LPPOINT)&rc);
+          rc.top += 20;
+          rc.left -= (size.cx / 2);
+          rc.top  -= (size.cy / 2);
+        } else
+        {
+          rc.left = (rcTool.left + rcTool.right-size.cx)/ 2;
+          rc.top  = rcTool.bottom+2;
+        }
+
+      } else
+      {
+        GetCursorPos((LPPOINT)&rc);
+        rc.top += 20;
       }
 
       /* smart placement */
-      if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) &&
-          (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom))
-          rect.left = rcTool.right;
+      if (infoPtr->bTrackActive)
+      {
+        if ((rc.left + size.cx > rcTool.left) && (rc.left < rcTool.right) &&
+            (rc.top + size.cy > rcTool.top) && (rc.top < rcTool.bottom))
+            rc.left = rcTool.right;
+      }
     }
 
 //    TRACE (tooltips, "pos %d - %d\n", rect.left, rect.top);
 
-    rect.right = rect.left+size.cx;
-    rect.bottom = rect.top+size.cy;
-
-    AdjustWindowRectEx (&rect,GetWindowLongA(hwnd,GWL_STYLE),
+    rc.right = rc.left+size.cx;
+    rc.bottom = rc.top+size.cy;
+
+    AdjustWindowRectEx (&rc,GetWindowLongA(hwnd,GWL_STYLE),
                         FALSE,GetWindowLongA(hwnd,GWL_EXSTYLE));
+
+    *lpRect = rc;
+
+}
+
+
+static VOID
+TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
+{
+    TTTOOL_INFO *toolPtr;
+    RECT rect;
+    HDC  hdc;
+    NMHDR  hdr;
+
+    if (infoPtr->nTool == -1)
+    {
+//      TRACE (tooltips, "invalid tool (-1)!\n");
+        return;
+    }
+
+    infoPtr->nCurrentTool = infoPtr->nTool;
+
+//    TRACE (tooltips, "Show tooltip pre %d!\n", infoPtr->nTool);
+    TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nCurrentTool);
+
+    if (infoPtr->szTipText[0] == '\0')
+    {
+        infoPtr->nCurrentTool = -1;
+        return;
+    }
+
+//    TRACE (tooltips, "Show tooltip %d!\n", infoPtr->nCurrentTool);
+    toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
+
+    hdr.hwndFrom = hwnd;
+    hdr.idFrom = toolPtr->uId;
+    hdr.code = TTN_SHOW;
+    SendMessageA(toolPtr->hwnd,WM_NOTIFY,
+                    (WPARAM)toolPtr->uId,(LPARAM)&hdr);
+
+//    TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
+
+    TOOLTIPS_CalcTipRect(hwnd,infoPtr,toolPtr,&rect);
+
+    SetWindowPos (hwnd,HWND_TOP,rect.left,rect.top,
+                    rect.right-rect.left,rect.bottom-rect.top,
+                    SWP_SHOWWINDOW | SWP_NOACTIVATE);
+
+    /* repaint the tooltip */
+    hdc = GetDC(hwnd);
+    TOOLTIPS_Refresh(hwnd,hdc);
+    ReleaseDC(hwnd,hdc);
+
+    SetTimer (hwnd,ID_TIMERPOP,infoPtr->nAutoPopTime,0);
+}
+
+
+static VOID
+TOOLTIPS_Hide (HWND hwnd, TOOLTIPS_INFO *infoPtr)
+{
+    TTTOOL_INFO *toolPtr;
+    NMHDR hdr;
+
+    if (infoPtr->nCurrentTool == -1)
+        return;
+
+    toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
+//    TRACE (tooltips, "Hide tooltip %d!\n", infoPtr->nCurrentTool);
+    KillTimer (hwnd, ID_TIMERPOP);
+
+    hdr.hwndFrom = hwnd;
+    hdr.idFrom = toolPtr->uId;
+    hdr.code = TTN_POP;
+    SendMessageA (toolPtr->hwnd, WM_NOTIFY,
+                    (WPARAM)toolPtr->uId, (LPARAM)&hdr);
+
+    infoPtr->nCurrentTool = -1;
+
+    SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
+                    SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
+}
+
+
+static VOID
+TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr)
+{
+    TTTOOL_INFO *toolPtr;
+    RECT rect;
+    HDC  hdc;
+    NMHDR hdr;
+
+    if (infoPtr->nTrackTool == -1)
+    {
+//    TRACE (tooltips, "invalid tracking tool (-1)!\n");
+      return;
+    }
+
+//    TRACE (tooltips, "show tracking tooltip pre %d!\n", infoPtr->nTrackTool);
+
+    TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nTrackTool);
+
+    if (infoPtr->szTipText[0] == '\0')
+    {
+      infoPtr->nTrackTool = -1;
+      return;
+    }
+
+//    TRACE (tooltips, "show tracking tooltip %d!\n", infoPtr->nTrackTool);
+    toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
+
+    hdr.hwndFrom = hwnd;
+    hdr.idFrom = toolPtr->uId;
+    hdr.code = TTN_SHOW;
+    SendMessageA(toolPtr->hwnd,WM_NOTIFY,(WPARAM)toolPtr->uId,(LPARAM)&hdr);
+
+//    TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText));
+
+    TOOLTIPS_CalcTipRect(hwnd,infoPtr,toolPtr,&rect);
 
     SetWindowPos (hwnd,HWND_TOP,rect.left,rect.top,
@@ -1701,5 +1688,4 @@
 //      TRACE (tooltips, "[%d %d]\n",
 //             infoPtr->xTrackPos, infoPtr->yTrackPos);
-
       TOOLTIPS_TrackShow(hwnd,infoPtr);
     }
@@ -2058,5 +2044,5 @@
     if(wParam < length)
     {
-        lstrcpynWtoA((LPSTR)lParam,infoPtr->szTipText,MIN((UINT)wParam,lstrlenW(infoPtr->szTipText)));
+        lstrcpynWtoA((LPSTR)lParam,infoPtr->szTipText,(UINT)wParam);//includes 0 terminator
         return wParam;
     }
Index: trunk/src/comctl32/trackbar.c
===================================================================
--- trunk/src/comctl32/trackbar.c	(revision 250)
+++ trunk/src/comctl32/trackbar.c	(revision 252)
@@ -1,3 +1,3 @@
-/* $Id: trackbar.c,v 1.9 1999-06-28 15:46:28 cbratschi Exp $ */
+/* $Id: trackbar.c,v 1.10 1999-06-30 15:52:18 cbratschi Exp $ */
 /*
  * Trackbar control
@@ -67,4 +67,9 @@
 #define SCROLL_TIMER_ID 1
 
+/* Tooltips */
+
+#define TOOLTIP_XSPACE 5
+#define TOOLTIP_YSPACE 5
+
 static BOOL TRACKBAR_SendNotify (HWND hwnd, UINT code);
 
@@ -78,4 +83,5 @@
       COMCTL32_Free(infoPtr->tics);
       infoPtr->tics = NULL;
+
       infoPtr->uNumTics = 0;
       return;
@@ -1570,4 +1576,19 @@
 
     return 0;
+}
+
+/* pt intialized with cursor position */
+
+static VOID TRACKBAR_CalcToolTipPos(HWND hwnd,DWORD dwStyle,TRACKBAR_INFO *infoPtr,POINT *pt)
+{
+  if (dwStyle & TBS_VERT)
+  {
+    pt->x += 5;
+    pt->y += 15;
+  } else
+  {
+    pt->x += 15;
+    pt->y += 5;
+  }
 }
 
@@ -1613,4 +1634,5 @@
 
            GetCursorPos(&pt);
+           TRACKBAR_CalcToolTipPos(hwnd,dwStyle,infoPtr,&pt);
            SendMessageA(infoPtr->hwndToolTip,TTM_TRACKPOSITION,0,(LPARAM)MAKELPARAM(pt.x,pt.y));
 
@@ -1906,13 +1928,8 @@
       ti.lpszText = (LPSTR)buf;
       GetCursorPos(&pt);
+      TRACKBAR_CalcToolTipPos(hwnd,dwStyle,infoPtr,&pt);
 
       SendMessageA(infoPtr->hwndToolTip,TTM_UPDATETIPTEXTA,0,(LPARAM)&ti);
-      if (dwStyle & TBS_VERT)
-      {
-        SendMessageA(infoPtr->hwndToolTip,TTM_TRACKPOSITION,0,(LPARAM)MAKELPARAM(pt.x+5,pt.y+15)); //CB: optimize
-      } else
-      {
-        SendMessageA(infoPtr->hwndToolTip,TTM_TRACKPOSITION,0,(LPARAM)MAKELPARAM(pt.x+15,pt.y+5)); //CB: optimize
-      }
+      SendMessageA(infoPtr->hwndToolTip,TTM_TRACKPOSITION,0,(LPARAM)MAKELPARAM(pt.x,pt.y));
     }
 
Index: trunk/src/comctl32/treeview.c
===================================================================
--- trunk/src/comctl32/treeview.c	(revision 250)
+++ trunk/src/comctl32/treeview.c	(revision 252)
@@ -1,3 +1,3 @@
-/* $Id: treeview.c,v 1.6 1999-06-28 15:46:28 cbratschi Exp $ */
+/* $Id: treeview.c,v 1.7 1999-06-30 15:52:19 cbratschi Exp $ */
 /* Treeview control
  *
@@ -897,5 +897,5 @@
         if (len > wineItem->cchTextMax)
                         wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, len+1);
-        lstrcpynA (wineItem->pszText, tvItem->pszText,len);
+        lstrcpynA (wineItem->pszText, tvItem->pszText,len+1);
                 } else {
                         if (wineItem->cchTextMax) {
@@ -1166,5 +1166,5 @@
         }
         else if (wineItem->pszText) {
-            lstrcpynA (tvItem->pszText, wineItem->pszText, MIN(tvItem->cchTextMax,lstrlenA(wineItem->pszText)));
+            lstrcpynA (tvItem->pszText, wineItem->pszText,tvItem->cchTextMax);
         }
    }
