[COMCTL32] Sync with Wine 3.0. CORE-14225
authorAmine Khaldi <amine.khaldi@reactos.org>
Thu, 18 Jan 2018 22:49:20 +0000 (23:49 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Thu, 18 Jan 2018 22:49:20 +0000 (23:49 +0100)
dll/win32/comctl32/comctl32.h
dll/win32/comctl32/commctrl.c
dll/win32/comctl32/imagelist.c
dll/win32/comctl32/listview.c
dll/win32/comctl32/rebar.c
dll/win32/comctl32/status.c
dll/win32/comctl32/syslink.c
dll/win32/comctl32/taskdialog.c
dll/win32/comctl32/tooltips.c
dll/win32/comctl32/updown.c
media/doc/README.WINE

index e347efd..17b6767 100644 (file)
@@ -77,6 +77,8 @@ typedef struct
 
 extern COMCTL32_SysColor  comctl32_color DECLSPEC_HIDDEN;
 
 
 extern COMCTL32_SysColor  comctl32_color DECLSPEC_HIDDEN;
 
+#ifdef __REACTOS__
+
 typedef struct _BUTTON_DATA {
     LONG state;
     HFONT font;
 typedef struct _BUTTON_DATA {
     LONG state;
     HFONT font;
@@ -92,6 +94,8 @@ static inline PBUTTON_DATA _GetButtonData(HWND hwnd)
     return (PBUTTON_DATA)GetWindowLongPtrW( hwnd, 0 );
 }
 
     return (PBUTTON_DATA)GetWindowLongPtrW( hwnd, 0 );
 }
 
+#endif /* __REACTOS__ */
+
 /* Internal function */
 HWND COMCTL32_CreateToolTip (HWND) DECLSPEC_HIDDEN;
 VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN;
 /* Internal function */
 HWND COMCTL32_CreateToolTip (HWND) DECLSPEC_HIDDEN;
 VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN;
@@ -104,6 +108,10 @@ INT  Str_GetPtrAtoW (LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN;
 BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN;
 BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN;
 
 BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN;
 BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN;
 
+#ifndef __REACTOS__
+#define COMCTL32_VERSION_MINOR 81
+#endif
+
 /* Our internal stack structure of the window procedures to subclass */
 typedef struct _SUBCLASSPROCS {
     SUBCLASSPROC subproc;
 /* Our internal stack structure of the window procedures to subclass */
 typedef struct _SUBCLASSPROCS {
     SUBCLASSPROC subproc;
@@ -175,18 +183,21 @@ extern void TREEVIEW_Register(void) DECLSPEC_HIDDEN;
 extern void TREEVIEW_Unregister(void) DECLSPEC_HIDDEN;
 extern void UPDOWN_Register(void) DECLSPEC_HIDDEN;
 extern void UPDOWN_Unregister(void) DECLSPEC_HIDDEN;
 extern void TREEVIEW_Unregister(void) DECLSPEC_HIDDEN;
 extern void UPDOWN_Register(void) DECLSPEC_HIDDEN;
 extern void UPDOWN_Unregister(void) DECLSPEC_HIDDEN;
+#ifdef __REACTOS__
 extern void BUTTON_Register();
 extern void BUTTON_Unregister();
 extern void BUTTON_Register();
 extern void BUTTON_Unregister();
-#ifdef __REACTOS__
 extern void TOOLBARv6_Register(void) DECLSPEC_HIDDEN;
 extern void TOOLBARv6_Unregister(void) DECLSPEC_HIDDEN;
 extern void TOOLBARv6_Register(void) DECLSPEC_HIDDEN;
 extern void TOOLBARv6_Unregister(void) DECLSPEC_HIDDEN;
-#endif
+#endif /* __REACTOS__ */
 
 int MONTHCAL_MonthLength(int month, int year) DECLSPEC_HIDDEN;
 int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace) DECLSPEC_HIDDEN;
 LONG MONTHCAL_CompareSystemTime(const SYSTEMTIME *first, const SYSTEMTIME *second) DECLSPEC_HIDDEN;
 
 int MONTHCAL_MonthLength(int month, int year) DECLSPEC_HIDDEN;
 int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace) DECLSPEC_HIDDEN;
 LONG MONTHCAL_CompareSystemTime(const SYSTEMTIME *first, const SYSTEMTIME *second) DECLSPEC_HIDDEN;
-
+#ifdef __REACTOS__
 extern void THEMING_Initialize(HANDLE hActCtx5, HANDLE hActCtx6) DECLSPEC_HIDDEN;
 extern void THEMING_Initialize(HANDLE hActCtx5, HANDLE hActCtx6) DECLSPEC_HIDDEN;
+#else
+extern void THEMING_Initialize(void) DECLSPEC_HIDDEN;
+#endif
 extern void THEMING_Uninitialize(void) DECLSPEC_HIDDEN;
 extern LRESULT THEMING_CallOriginalClass(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN;
 extern void THEMING_SetSubclassData(HWND, ULONG_PTR) DECLSPEC_HIDDEN;
 extern void THEMING_Uninitialize(void) DECLSPEC_HIDDEN;
 extern LRESULT THEMING_CallOriginalClass(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN;
 extern void THEMING_SetSubclassData(HWND, ULONG_PTR) DECLSPEC_HIDDEN;
index df063c0..1bdc71d 100644 (file)
@@ -275,7 +275,7 @@ BOOLEAN WINAPI RegisterClassNameW(LPCWSTR className)
     return TRUE;
 }
 
     return TRUE;
 }
 
-#endif
+#endif /* __REACTOS__ */
 
 /***********************************************************************
  * DllMain [Internal]
 
 /***********************************************************************
  * DllMain [Internal]
@@ -1120,7 +1120,6 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
 {
     TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline));
 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
 {
     TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline));
-
     return S_OK;
 }
 
     return S_OK;
 }
 
index a47f879..c076002 100644 (file)
@@ -283,7 +283,7 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
         mask_info->bmiHeader = info->bmiHeader;
         mask_info->bmiHeader.biBitCount = 1;
         mask_info->bmiHeader.biSizeImage = mask_width * height;
         mask_info->bmiHeader = info->bmiHeader;
         mask_info->bmiHeader.biBitCount = 1;
         mask_info->bmiHeader.biSizeImage = mask_width * height;
-        if (!(mask_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage )))
+        if (!(mask_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mask_info->bmiHeader.biSizeImage )))
             goto done;
         if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) goto done;
     }
             goto done;
         if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) goto done;
     }
@@ -2132,7 +2132,8 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
 
         nImageCount = dib.dsBm.bmWidth / cx;
 
 
         nImageCount = dib.dsBm.bmWidth / cx;
 
-        himl = ImageList_Create (cx, dib.dsBm.bmHeight, ILC_MASK | color, nImageCount, cGrow);
+        if (clrMask != CLR_NONE) color |= ILC_MASK;
+        himl = ImageList_Create (cx, dib.dsBm.bmHeight, color, nImageCount, cGrow);
         if (!himl) {
             DeleteObject (handle);
             return NULL;
         if (!himl) {
             DeleteObject (handle);
             return NULL;
index 064de95..00c6ba2 100644 (file)
@@ -1001,7 +1001,7 @@ static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, UINT code, LPNMLVDISP
         return ret;
     }
 
         return ret;
     }
 
-    /* if dipsinfo holder changed notification code then convert */
+    /* if dispinfo holder changed notification code then convert */
     if (!isW && (pdi->hdr.code == LVN_GETDISPINFOW) && (pdi->item.mask & LVIF_TEXT))
     {
         length = WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
     if (!isW && (pdi->hdr.code == LVN_GETDISPINFOW) && (pdi->item.mask & LVIF_TEXT))
     {
         length = WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
@@ -1055,7 +1055,7 @@ static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRA
     COLORREF backcolor, textcolor;
 
     /* apparently, for selected items, we have to override the returned values */
     COLORREF backcolor, textcolor;
 
     /* apparently, for selected items, we have to override the returned values */
-    if (!SubItem || (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
+    if (!SubItem)
     {
         if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
         {
     {
         if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
         {
@@ -3843,33 +3843,44 @@ static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, INT x, INT y)
  *   None.
  */
 static void LISTVIEW_MarqueeHighlight(LISTVIEW_INFO *infoPtr, const POINT *coords_orig,
  *   None.
  */
 static void LISTVIEW_MarqueeHighlight(LISTVIEW_INFO *infoPtr, const POINT *coords_orig,
-                                      const POINT *coords_offs, const POINT *offset,
                                       INT scroll)
 {
     BOOL controlDown = FALSE;
     LVITEMW item;
     ITERATOR old_elems, new_elems;
     RECT rect;
                                       INT scroll)
 {
     BOOL controlDown = FALSE;
     LVITEMW item;
     ITERATOR old_elems, new_elems;
     RECT rect;
+    POINT coords_offs, offset;
 
 
-    if (coords_offs->x > infoPtr->marqueeOrigin.x)
+    /* Ensure coordinates are within client bounds */
+    coords_offs.x = max(min(coords_orig->x, infoPtr->rcList.right), 0);
+    coords_offs.y = max(min(coords_orig->y, infoPtr->rcList.bottom), 0);
+
+    /* Get offset */
+    LISTVIEW_GetOrigin(infoPtr, &offset);
+
+    /* Offset coordinates by the appropriate amount */
+    coords_offs.x -= offset.x;
+    coords_offs.y -= offset.y;
+
+    if (coords_offs.x > infoPtr->marqueeOrigin.x)
     {
         rect.left = infoPtr->marqueeOrigin.x;
     {
         rect.left = infoPtr->marqueeOrigin.x;
-        rect.right = coords_offs->x;
+        rect.right = coords_offs.x;
     }
     else
     {
     }
     else
     {
-        rect.left = coords_offs->x;
+        rect.left = coords_offs.x;
         rect.right = infoPtr->marqueeOrigin.x;
     }
 
         rect.right = infoPtr->marqueeOrigin.x;
     }
 
-    if (coords_offs->y > infoPtr->marqueeOrigin.y)
+    if (coords_offs.y > infoPtr->marqueeOrigin.y)
     {
         rect.top = infoPtr->marqueeOrigin.y;
     {
         rect.top = infoPtr->marqueeOrigin.y;
-        rect.bottom = coords_offs->y;
+        rect.bottom = coords_offs.y;
     }
     else
     {
     }
     else
     {
-        rect.top = coords_offs->y;
+        rect.top = coords_offs.y;
         rect.bottom = infoPtr->marqueeOrigin.y;
     }
 
         rect.bottom = infoPtr->marqueeOrigin.y;
     }
 
@@ -3895,7 +3906,7 @@ static void LISTVIEW_MarqueeHighlight(LISTVIEW_INFO *infoPtr, const POINT *coord
 
     infoPtr->marqueeRect = rect;
     infoPtr->marqueeDrawRect = rect;
 
     infoPtr->marqueeRect = rect;
     infoPtr->marqueeDrawRect = rect;
-    OffsetRect(&infoPtr->marqueeDrawRect, offset->x, offset->y);
+    OffsetRect(&infoPtr->marqueeDrawRect, offset.x, offset.y);
 
     iterator_frameditems_absolute(&new_elems, infoPtr, &infoPtr->marqueeRect);
     iterator_remove_common_items(&old_elems, &new_elems);
 
     iterator_frameditems_absolute(&new_elems, infoPtr, &infoPtr->marqueeRect);
     iterator_remove_common_items(&old_elems, &new_elems);
@@ -3960,9 +3971,7 @@ static VOID CALLBACK LISTVIEW_ScrollTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent
 {
     LISTVIEW_INFO *infoPtr;
     SCROLLINFO scrollInfo;
 {
     LISTVIEW_INFO *infoPtr;
     SCROLLINFO scrollInfo;
-    POINT coords_orig;
-    POINT coords_offs;
-    POINT offset;
+    POINT coords;
     INT scroll = 0;
 
     infoPtr = (LISTVIEW_INFO *) idEvent;
     INT scroll = 0;
 
     infoPtr = (LISTVIEW_INFO *) idEvent;
@@ -3971,19 +3980,8 @@ static VOID CALLBACK LISTVIEW_ScrollTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent
         return;
 
     /* Get the current cursor position and convert to client coordinates */
         return;
 
     /* Get the current cursor position and convert to client coordinates */
-    GetCursorPos(&coords_orig);
-    ScreenToClient(hWnd, &coords_orig);
-
-    /* Ensure coordinates are within client bounds */
-    coords_offs.x = max(min(coords_orig.x, infoPtr->rcList.right), 0);
-    coords_offs.y = max(min(coords_orig.y, infoPtr->rcList.bottom), 0);
-
-    /* Get offset */
-    LISTVIEW_GetOrigin(infoPtr, &offset);
-
-    /* Offset coordinates by the appropriate amount */
-    coords_offs.x -= offset.x;
-    coords_offs.y -= offset.y;
+    GetCursorPos(&coords);
+    ScreenToClient(hWnd, &coords);
 
     scrollInfo.cbSize = sizeof(SCROLLINFO);
     scrollInfo.fMask = SIF_ALL;
 
     scrollInfo.cbSize = sizeof(SCROLLINFO);
     scrollInfo.fMask = SIF_ALL;
@@ -4007,12 +4005,12 @@ static VOID CALLBACK LISTVIEW_ScrollTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent
             scroll |= SCROLL_RIGHT;
     }
 
             scroll |= SCROLL_RIGHT;
     }
 
-    if (((coords_orig.x <= 0) && (scroll & SCROLL_LEFT)) ||
-        ((coords_orig.y <= 0) && (scroll & SCROLL_UP))   ||
-        ((coords_orig.x >= infoPtr->rcList.right) && (scroll & SCROLL_RIGHT)) ||
-        ((coords_orig.y >= infoPtr->rcList.bottom) && (scroll & SCROLL_DOWN)))
+    if (((coords.x <= 0) && (scroll & SCROLL_LEFT)) ||
+        ((coords.y <= 0) && (scroll & SCROLL_UP))   ||
+        ((coords.x >= infoPtr->rcList.right) && (scroll & SCROLL_RIGHT)) ||
+        ((coords.y >= infoPtr->rcList.bottom) && (scroll & SCROLL_DOWN)))
     {
     {
-        LISTVIEW_MarqueeHighlight(infoPtr, &coords_orig, &coords_offs, &offset, scroll);
+        LISTVIEW_MarqueeHighlight(infoPtr, &coords, scroll);
     }
 }
 
     }
 }
 
@@ -4034,6 +4032,9 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
     RECT rect;
     POINT pt;
 
     RECT rect;
     POINT pt;
 
+    pt.x = x;
+    pt.y = y;
+
     if (!(fwKeys & MK_LBUTTON))
         infoPtr->bLButtonDown = FALSE;
 
     if (!(fwKeys & MK_LBUTTON))
         infoPtr->bLButtonDown = FALSE;
 
@@ -4046,24 +4047,6 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
 
         if (infoPtr->bMarqueeSelect)
         {
 
         if (infoPtr->bMarqueeSelect)
         {
-            POINT coords_orig;
-            POINT coords_offs;
-            POINT offset;
-
-            coords_orig.x = x;
-            coords_orig.y = y;
-
-            /* Get offset */
-            LISTVIEW_GetOrigin(infoPtr, &offset);
-
-            /* Ensure coordinates are within client bounds */
-            coords_offs.x = max(min(x, infoPtr->rcList.right), 0);
-            coords_offs.y = max(min(y, infoPtr->rcList.bottom), 0);
-
-            /* Offset coordinates by the appropriate amount */
-            coords_offs.x -= offset.x;
-            coords_offs.y -= offset.y;
-
             /* Enable the timer if we're going outside our bounds, in case the user doesn't
                move the mouse again */
 
             /* Enable the timer if we're going outside our bounds, in case the user doesn't
                move the mouse again */
 
@@ -4082,13 +4065,10 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
                 KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr);
             }
 
                 KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr);
             }
 
-            LISTVIEW_MarqueeHighlight(infoPtr, &coords_orig, &coords_offs, &offset, 0);
+            LISTVIEW_MarqueeHighlight(infoPtr, &pt, 0);
             return 0;
         }
 
             return 0;
         }
 
-        pt.x = x;
-        pt.y = y;
-
         ht.pt = pt;
         LISTVIEW_HitTest(infoPtr, &ht, TRUE, TRUE);
 
         ht.pt = pt;
         LISTVIEW_HitTest(infoPtr, &ht, TRUE, TRUE);
 
@@ -4808,7 +4788,6 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERAT
         while (iterator_next(subitems))
         {
             DWORD subitemstage = CDRF_DODEFAULT;
         while (iterator_next(subitems))
         {
             DWORD subitemstage = CDRF_DODEFAULT;
-            NMLVCUSTOMDRAW temp_nmlvcd;
 
             /* We need to query for each subitem, item's data (subitem == 0) is already here at this point */
             if (subitems->nItem)
 
             /* We need to query for each subitem, item's data (subitem == 0) is already here at this point */
             if (subitems->nItem)
@@ -4835,16 +4814,19 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERAT
 
             if (cdsubitemmode & CDRF_NOTIFYSUBITEMDRAW)
                 subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPREPAINT, &nmlvcd);
 
             if (cdsubitemmode & CDRF_NOTIFYSUBITEMDRAW)
                 subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPREPAINT, &nmlvcd);
+            else
+            {
+                nmlvcd.clrTextBk = infoPtr->clrTextBk;
+                nmlvcd.clrText   = infoPtr->clrText;
+            }
 
 
-            /*
-             * A selection should neither affect the colors in the post paint notification nor
-             * affect the colors of the next drawn subitem. Copy the structure to prevent this.
-             */
-            temp_nmlvcd = nmlvcd;
-            prepaint_setup(infoPtr, hdc, &temp_nmlvcd, subitems->nItem);
+            if (subitems->nItem == 0 || (cdmode & CDRF_NOTIFYITEMDRAW))
+                prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);
+            else if (!(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
+                prepaint_setup(infoPtr, hdc, &nmlvcd, TRUE);
 
             if (!(subitemstage & CDRF_SKIPDEFAULT))
 
             if (!(subitemstage & CDRF_SKIPDEFAULT))
-                LISTVIEW_DrawItemPart(infoPtr, &lvItem, &temp_nmlvcd, &pos);
+                LISTVIEW_DrawItemPart(infoPtr, &lvItem, &nmlvcd, &pos);
 
             if (subitemstage & CDRF_NOTIFYPOSTPAINT)
                 subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPOSTPAINT, &nmlvcd);
 
             if (subitemstage & CDRF_NOTIFYPOSTPAINT)
                 subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPOSTPAINT, &nmlvcd);
@@ -8864,6 +8846,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
            if (infoPtr->nFocusedItem >= nItems)
            {
                LISTVIEW_SetItemFocus(infoPtr, -1);
            if (infoPtr->nFocusedItem >= nItems)
            {
                LISTVIEW_SetItemFocus(infoPtr, -1);
+                infoPtr->nFocusedItem = -1;
                SetRectEmpty(&infoPtr->rcFocus);
            }
        }
                SetRectEmpty(&infoPtr->rcFocus);
            }
        }
@@ -9483,7 +9466,7 @@ static VOID CALLBACK LISTVIEW_DelayedEditItem(HWND hwnd, UINT uMsg, UINT_PTR idE
  *   Success: TRUE
  *   Failure: FALSE
  */
  *   Success: TRUE
  *   Failure: FALSE
  */
-static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
+static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
 {
   LISTVIEW_INFO *infoPtr;
   LOGFONTW logFont;
 {
   LISTVIEW_INFO *infoPtr;
   LOGFONTW logFont;
@@ -9545,7 +9528,8 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
   if (!(infoPtr->hdpaPosX  = DPA_Create(10))) goto fail;
   if (!(infoPtr->hdpaPosY  = DPA_Create(10))) goto fail;
   if (!(infoPtr->hdpaColumns = DPA_Create(10))) goto fail;
   if (!(infoPtr->hdpaPosX  = DPA_Create(10))) goto fail;
   if (!(infoPtr->hdpaPosY  = DPA_Create(10))) goto fail;
   if (!(infoPtr->hdpaColumns = DPA_Create(10))) goto fail;
-  return TRUE;
+
+  return DefWindowProcW(hwnd, WM_NCCREATE, wParam, (LPARAM)lpcs);
 
 fail:
     DestroyWindow(infoPtr->hwndHeader);
 
 fail:
     DestroyWindow(infoPtr->hwndHeader);
@@ -11711,7 +11695,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     return LISTVIEW_Command(infoPtr, wParam, lParam);
 
   case WM_NCCREATE:
     return LISTVIEW_Command(infoPtr, wParam, lParam);
 
   case WM_NCCREATE:
-    return LISTVIEW_NCCreate(hwnd, (LPCREATESTRUCTW)lParam);
+    return LISTVIEW_NCCreate(hwnd, wParam, (LPCREATESTRUCTW)lParam);
 
   case WM_CREATE:
     return LISTVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam);
 
   case WM_CREATE:
     return LISTVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam);
index d489614..38a7004 100644 (file)
@@ -613,6 +613,7 @@ REBAR_DrawBand (HDC hdc, const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
            oldcolor = SetTextColor (hdc, new);
        }
 
            oldcolor = SetTextColor (hdc, new);
        }
 
+#ifdef __REACTOS__
     if (!theme)
     {
         DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
     if (!theme)
     {
         DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
@@ -621,6 +622,10 @@ REBAR_DrawBand (HDC hdc, const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
     {
         DrawThemeText(theme, hdc, 0, 0, lpBand->lpText, -1, DT_CENTER | DT_VCENTER | DT_SINGLELINE, 0, &lpBand->rcCapText);
     }
     {
         DrawThemeText(theme, hdc, 0, 0, lpBand->lpText, -1, DT_CENTER | DT_VCENTER | DT_SINGLELINE, 0, &lpBand->rcCapText);
     }
+#else
+       DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
+                  DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+#endif
 
        if (oldBkMode != TRANSPARENT)
            SetBkMode (hdc, oldBkMode);
 
        if (oldBkMode != TRANSPARENT)
            SetBkMode (hdc, oldBkMode);
@@ -1843,7 +1848,6 @@ static LRESULT REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc)
     oldrow = -1;
     for(i=0; i<infoPtr->uNumBands; i++) {
         RECT rcBand;
     oldrow = -1;
     for(i=0; i<infoPtr->uNumBands; i++) {
         RECT rcBand;
-
         lpBand = REBAR_GetBand(infoPtr, i);
        if (HIDDENBAND(lpBand)) continue;
         translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
         lpBand = REBAR_GetBand(infoPtr, i);
        if (HIDDENBAND(lpBand)) continue;
         translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
index e18a47e..cdfad32 100644 (file)
@@ -196,10 +196,14 @@ STATUSBAR_DrawPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART
         SendMessageW (infoPtr->Notify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
     } else {
         r.left += x;
         SendMessageW (infoPtr->Notify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
     } else {
         r.left += x;
+#ifdef __REACTOS__
         if (!theme)
             DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
         else
             DrawThemeText(theme, hdc, SP_PANE, 0, part->text, -1, DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX, 0, &r);
         if (!theme)
             DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
         else
             DrawThemeText(theme, hdc, SP_PANE, 0, part->text, -1, DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX, 0, &r);
+#else
+        DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
+#endif
     }
 }
 
     }
 }
 
index 675ef62..d54b0f5 100644 (file)
@@ -1463,7 +1463,7 @@ static BOOL SYSLINK_NoNextLink (const SYSLINK_INFO *infoPtr, BOOL Prev)
  *           SYSLINK_GetIdealSize
  * Calculates the ideal size of a link control at a given maximum width.
  */
  *           SYSLINK_GetIdealSize
  * Calculates the ideal size of a link control at a given maximum width.
  */
-static VOID SYSLINK_GetIdealSize (const SYSLINK_INFO *infoPtr, int cxMaxWidth, LPSIZE lpSize)
+static LONG SYSLINK_GetIdealSize (const SYSLINK_INFO *infoPtr, int cxMaxWidth, SIZE *lpSize)
 {
     RECT rc;
     HDC hdc;
 {
     RECT rc;
     HDC hdc;
@@ -1484,6 +1484,8 @@ static VOID SYSLINK_GetIdealSize (const SYSLINK_INFO *infoPtr, int cxMaxWidth, L
         lpSize->cx = rc.right;
         lpSize->cy = rc.bottom;
     }
         lpSize->cx = rc.right;
         lpSize->cy = rc.bottom;
     }
+
+    return rc.bottom;
 }
 
 /***********************************************************************
 }
 
 /***********************************************************************
@@ -1655,11 +1657,9 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
 
     case LM_GETIDEALHEIGHT:
         if (lParam)
 
     case LM_GETIDEALHEIGHT:
         if (lParam)
-        {
-            /* LM_GETIDEALSIZE */
-            SYSLINK_GetIdealSize(infoPtr, (int)wParam, (LPSIZE)lParam);
-        }
-        return SYSLINK_GetIdealHeight(infoPtr);
+            return SYSLINK_GetIdealSize(infoPtr, (int)wParam, (SIZE *)lParam);
+        else
+            return SYSLINK_GetIdealHeight(infoPtr);
 
     case WM_SETFOCUS:
         return SYSLINK_SetFocus(infoPtr);
 
     case WM_SETFOCUS:
         return SYSLINK_SetFocus(infoPtr);
index 9cf2726..339ebce 100644 (file)
@@ -43,6 +43,15 @@ struct taskdialog_control
     unsigned int template_size;
 };
 
     unsigned int template_size;
 };
 
+struct taskdialog_button_desc
+{
+    int id;
+    const WCHAR *text;
+    unsigned int width;
+    unsigned int line;
+    HINSTANCE hinst;
+};
+
 struct taskdialog_template_desc
 {
     const TASKDIALOGCONFIG *taskconfig;
 struct taskdialog_template_desc
 {
     const TASKDIALOGCONFIG *taskconfig;
@@ -53,15 +62,14 @@ struct taskdialog_template_desc
     LONG x_baseunit;
     LONG y_baseunit;
     HFONT font;
     LONG x_baseunit;
     LONG y_baseunit;
     HFONT font;
+    struct taskdialog_button_desc *default_button;
 };
 
 };
 
-struct taskdialog_button_desc
+struct taskdialog_info
 {
 {
-    int id;
-    const WCHAR *text;
-    unsigned int width;
-    unsigned int line;
-    HINSTANCE hinst;
+    HWND hwnd;
+    PFTASKDIALOGCALLBACK callback;
+    LONG_PTR callback_data;
 };
 
 static void pixels_to_dialogunits(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
 };
 
 static void pixels_to_dialogunits(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
@@ -128,7 +136,7 @@ static void taskdialog_get_text_extent(const struct taskdialog_template_desc *de
 }
 
 static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class,
 }
 
 static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class,
-        HINSTANCE hInstance, const WCHAR *text, short x, short y, short cx, short cy)
+        HINSTANCE hInstance, const WCHAR *text, DWORD style, short x, short y, short cx, short cy)
 {
     struct taskdialog_control *control = Alloc(sizeof(*control));
     unsigned int size, class_size, text_size;
 {
     struct taskdialog_control *control = Alloc(sizeof(*control));
     unsigned int size, class_size, text_size;
@@ -155,7 +163,7 @@ static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc
     control->template = template = Alloc(size);
     control->template_size = size;
 
     control->template = template = Alloc(size);
     control->template_size = size;
 
-    template->style = WS_VISIBLE;
+    template->style = WS_VISIBLE | style;
     template->dwExtendedStyle = 0;
     template->x = x;
     template->y = y;
     template->dwExtendedStyle = 0;
     template->x = x;
     template->y = y;
@@ -183,7 +191,7 @@ static unsigned int taskdialog_add_static_label(struct taskdialog_template_desc
     taskdialog_get_text_extent(desc, str, TRUE, &sz);
 
     desc->dialog_height += DIALOG_SPACING;
     taskdialog_get_text_extent(desc, str, TRUE, &sz);
 
     desc->dialog_height += DIALOG_SPACING;
-    size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, DIALOG_SPACING,
+    size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, 0, DIALOG_SPACING,
             desc->dialog_height, sz.cx, sz.cy);
     desc->dialog_height += sz.cy + DIALOG_SPACING;
     return size;
             desc->dialog_height, sz.cx, sz.cy);
     desc->dialog_height += sz.cy + DIALOG_SPACING;
     return size;
@@ -211,6 +219,9 @@ static void taskdialog_init_button(struct taskdialog_button_desc *button, struct
     button->width = max(DIALOG_BUTTON_WIDTH, sz.cx + DIALOG_SPACING * 2);
     button->line = 0;
     button->hinst = custom_button ? desc->taskconfig->hInstance : COMCTL32_hModule;
     button->width = max(DIALOG_BUTTON_WIDTH, sz.cx + DIALOG_SPACING * 2);
     button->line = 0;
     button->hinst = custom_button ? desc->taskconfig->hInstance : COMCTL32_hModule;
+
+    if (id == desc->taskconfig->nDefaultButton)
+        desc->default_button = button;
 }
 
 static void taskdialog_init_common_buttons(struct taskdialog_template_desc *desc, struct taskdialog_button_desc *buttons,
 }
 
 static void taskdialog_init_common_buttons(struct taskdialog_template_desc *desc, struct taskdialog_button_desc *buttons,
@@ -267,6 +278,9 @@ static unsigned int taskdialog_add_buttons(struct taskdialog_template_desc *desc
     if (count == 0)
         taskdialog_init_button(&buttons[count++], desc, IDOK, MAKEINTRESOURCEW(IDS_BUTTON_OK), FALSE);
 
     if (count == 0)
         taskdialog_init_button(&buttons[count++], desc, IDOK, MAKEINTRESOURCEW(IDS_BUTTON_OK), FALSE);
 
+    if (!desc->default_button)
+        desc->default_button = &buttons[0];
+
     /* For easy handling just allocate as many lines as buttons, the worst case. */
     line_widths = Alloc(count * sizeof(*line_widths));
 
     /* For easy handling just allocate as many lines as buttons, the worst case. */
     line_widths = Alloc(count * sizeof(*line_widths));
 
@@ -321,14 +335,16 @@ static unsigned int taskdialog_add_buttons(struct taskdialog_template_desc *desc
     location_x = alignment;
     for (i = 0; i < count; i++)
     {
     location_x = alignment;
     for (i = 0; i < count; i++)
     {
+        DWORD style = &buttons[i] == desc->default_button ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON;
+
         if (i > 0 && buttons[i].line != buttons[i - 1].line) /* New line */
         {
             location_x = alignment;
             desc->dialog_height += DIALOG_BUTTON_HEIGHT + DIALOG_SPACING;
         }
 
         if (i > 0 && buttons[i].line != buttons[i - 1].line) /* New line */
         {
             location_x = alignment;
             desc->dialog_height += DIALOG_BUTTON_HEIGHT + DIALOG_SPACING;
         }
 
-        size += taskdialog_add_control(desc, buttons[i].id, WC_BUTTONW, buttons[i].hinst, buttons[i].text, location_x,
-                desc->dialog_height, buttons[i].width, DIALOG_BUTTON_HEIGHT);
+        size += taskdialog_add_control(desc, buttons[i].id, WC_BUTTONW, buttons[i].hinst, buttons[i].text, style,
+                location_x, desc->dialog_height, buttons[i].width, DIALOG_BUTTON_HEIGHT);
 
         location_x += buttons[i].width + DIALOG_SPACING;
     }
 
         location_x += buttons[i].width + DIALOG_SPACING;
     }
@@ -376,6 +392,20 @@ static unsigned int taskdialog_get_reference_rect(const struct taskdialog_templa
     return info.rcWork.right - info.rcWork.left;
 }
 
     return info.rcWork.right - info.rcWork.left;
 }
 
+static WCHAR *taskdialog_get_exe_name(const TASKDIALOGCONFIG *taskconfig, WCHAR *name, DWORD length)
+{
+    DWORD len = GetModuleFileNameW(NULL, name, length);
+    if (len && len < length)
+    {
+        WCHAR *p;
+        if ((p = strrchrW(name, '/'))) name = p + 1;
+        if ((p = strrchrW(name, '\\'))) name = p + 1;
+        return name;
+    }
+    else
+        return NULL;
+}
+
 static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfig)
 {
     struct taskdialog_control *control, *control2;
 static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfig)
 {
     struct taskdialog_control *control, *control2;
@@ -386,15 +416,19 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
     const WCHAR *titleW = NULL;
     DLGTEMPLATE *template;
     NONCLIENTMETRICSW ncm;
     const WCHAR *titleW = NULL;
     DLGTEMPLATE *template;
     NONCLIENTMETRICSW ncm;
+    WCHAR pathW[MAX_PATH];
     RECT ref_rect;
     char *ptr;
     HDC hdc;
 
     /* Window title */
     if (!taskconfig->pszWindowTitle)
     RECT ref_rect;
     char *ptr;
     HDC hdc;
 
     /* Window title */
     if (!taskconfig->pszWindowTitle)
-        FIXME("use executable name for window title\n");
+        titleW = taskdialog_get_exe_name(taskconfig, pathW, sizeof(pathW)/sizeof(pathW[0]));
     else if (IS_INTRESOURCE(taskconfig->pszWindowTitle))
     else if (IS_INTRESOURCE(taskconfig->pszWindowTitle))
-        FIXME("load window title from resources\n");
+    {
+        if (!LoadStringW(taskconfig->hInstance, LOWORD(taskconfig->pszWindowTitle), (WCHAR *)&titleW, 0))
+            titleW = taskdialog_get_exe_name(taskconfig, pathW, sizeof(pathW)/sizeof(pathW[0]));
+    }
     else
         titleW = taskconfig->pszWindowTitle;
     if (!titleW)
     else
         titleW = taskconfig->pszWindowTitle;
     if (!titleW)
@@ -423,6 +457,7 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
     desc.dialog_height = 0;
     desc.dialog_width = max(taskconfig->cxWidth, DIALOG_MIN_WIDTH);
     desc.dialog_width = min(desc.dialog_width, screen_width);
     desc.dialog_height = 0;
     desc.dialog_width = max(taskconfig->cxWidth, DIALOG_MIN_WIDTH);
     desc.dialog_width = min(desc.dialog_width, screen_width);
+    desc.default_button = NULL;
 
     size += taskdialog_add_main_instruction(&desc);
     size += taskdialog_add_content(&desc);
 
     size += taskdialog_add_main_instruction(&desc);
     size += taskdialog_add_content(&desc);
@@ -466,20 +501,54 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
     return template;
 }
 
     return template;
 }
 
+static HRESULT taskdialog_notify(struct taskdialog_info *dialog_info, UINT notification, WPARAM wparam, LPARAM lparam)
+{
+    return dialog_info->callback ? dialog_info->callback(dialog_info->hwnd, notification, wparam, lparam,
+            dialog_info->callback_data) : S_OK;
+}
+
+static void taskdialog_on_button_click(struct taskdialog_info *dialog_info, WORD command_id)
+{
+    if (taskdialog_notify(dialog_info, TDN_BUTTON_CLICKED, command_id, 0) == S_OK)
+        EndDialog(dialog_info->hwnd, command_id);
+}
+
 static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
 static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
+    static const WCHAR taskdialog_info_propnameW[] = {'T','a','s','k','D','i','a','l','o','g','I','n','f','o',0};
+    struct taskdialog_info *dialog_info;
+
     TRACE("hwnd=%p msg=0x%04x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
 
     TRACE("hwnd=%p msg=0x%04x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
 
+    if (msg != WM_INITDIALOG)
+        dialog_info = GetPropW(hwnd, taskdialog_info_propnameW);
+
     switch (msg)
     {
     switch (msg)
     {
+        case TDM_CLICK_BUTTON:
+            taskdialog_on_button_click(dialog_info, LOWORD(wParam));
+            break;
+        case WM_INITDIALOG:
+            dialog_info = (struct taskdialog_info *)lParam;
+            dialog_info->hwnd = hwnd;
+            SetPropW(hwnd, taskdialog_info_propnameW, dialog_info);
+
+            taskdialog_notify(dialog_info, TDN_DIALOG_CONSTRUCTED, 0, 0);
+            break;
+        case WM_SHOWWINDOW:
+            taskdialog_notify(dialog_info, TDN_CREATED, 0, 0);
+            break;
         case WM_COMMAND:
             if (HIWORD(wParam) == BN_CLICKED)
             {
         case WM_COMMAND:
             if (HIWORD(wParam) == BN_CLICKED)
             {
-                WORD command_id = LOWORD(wParam);
-                EndDialog(hwnd, command_id);
+                taskdialog_on_button_click(dialog_info, LOWORD(wParam));
                 return TRUE;
             }
             break;
                 return TRUE;
             }
             break;
+        case WM_DESTROY:
+            taskdialog_notify(dialog_info, TDN_DESTROYED, 0, 0);
+            RemovePropW(hwnd, taskdialog_info_propnameW);
+            break;
     }
     return FALSE;
 }
     }
     return FALSE;
 }
@@ -490,13 +559,21 @@ static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
 HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *taskconfig, int *button,
                                   int *radio_button, BOOL *verification_flag_checked)
 {
 HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *taskconfig, int *button,
                                   int *radio_button, BOOL *verification_flag_checked)
 {
+    struct taskdialog_info dialog_info;
     DLGTEMPLATE *template;
     INT ret;
 
     TRACE("%p, %p, %p, %p\n", taskconfig, button, radio_button, verification_flag_checked);
 
     DLGTEMPLATE *template;
     INT ret;
 
     TRACE("%p, %p, %p, %p\n", taskconfig, button, radio_button, verification_flag_checked);
 
+    if (!taskconfig || taskconfig->cbSize != sizeof(TASKDIALOGCONFIG))
+        return E_INVALIDARG;
+
+    dialog_info.callback = taskconfig->pfCallback;
+    dialog_info.callback_data = taskconfig->lpCallbackData;
+
     template = create_taskdialog_template(taskconfig);
     template = create_taskdialog_template(taskconfig);
-    ret = DialogBoxIndirectParamW(taskconfig->hInstance, template, taskconfig->hwndParent, taskdialog_proc, 0);
+    ret = (short)DialogBoxIndirectParamW(taskconfig->hInstance, template, taskconfig->hwndParent,
+            taskdialog_proc, (LPARAM)&dialog_info);
     Free(template);
 
     if (button) *button = ret;
     Free(template);
 
     if (button) *button = ret;
index f92dd1b..b314493 100644 (file)
@@ -392,7 +392,7 @@ static void TOOLTIPS_GetDispInfoA(const TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *too
         }
     }
     else {
         }
     }
     else {
-        ERR("recursive text callback!\n");
+        ERR("recursive text callback\n");
         buffer[0] = '\0';
     }
 
         buffer[0] = '\0';
     }
 
@@ -448,7 +448,7 @@ static void TOOLTIPS_GetDispInfoW(const TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *too
         }
     }
     else {
         }
     }
     else {
-        ERR("recursive text callback!\n");
+        ERR("recursive text callback\n");
         buffer[0] = '\0';
     }
 
         buffer[0] = '\0';
     }
 
@@ -577,13 +577,13 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
     NMHDR  hdr;
     int ptfx = 0;
     DWORD style = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
     NMHDR  hdr;
     int ptfx = 0;
     DWORD style = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
-    INT nTool;
+    INT nTool, current;
 
     if (track_activate)
     {
         if (infoPtr->nTrackTool == -1)
         {
 
     if (track_activate)
     {
         if (infoPtr->nTrackTool == -1)
         {
-            TRACE("invalid tracking tool (-1)!\n");
+            TRACE("invalid tracking tool %d\n", infoPtr->nTrackTool);
             return;
         }
         nTool = infoPtr->nTrackTool;
             return;
         }
         nTool = infoPtr->nTrackTool;
@@ -592,25 +592,29 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
     {
         if (infoPtr->nTool == -1)
         {
     {
         if (infoPtr->nTool == -1)
         {
-            TRACE("invalid tool (-1)!\n");
-               return;
+            TRACE("invalid tool %d\n", infoPtr->nTool);
+            return;
         }
         nTool = infoPtr->nTool;
     }
 
         }
         nTool = infoPtr->nTool;
     }
 
-    TRACE("Show tooltip pre %d! (%p)\n", nTool, infoPtr->hwndSelf);
+    TRACE("Show tooltip pre %d, %p\n", nTool, infoPtr->hwndSelf);
+
+    current = infoPtr->nCurrentTool;
+    if (!track_activate)
+        infoPtr->nCurrentTool = infoPtr->nTool;
 
     TOOLTIPS_GetTipText (infoPtr, nTool, infoPtr->szTipText);
 
     if (infoPtr->szTipText[0] == '\0')
 
     TOOLTIPS_GetTipText (infoPtr, nTool, infoPtr->szTipText);
 
     if (infoPtr->szTipText[0] == '\0')
+    {
+        infoPtr->nCurrentTool = current;
         return;
         return;
+    }
 
     toolPtr = &infoPtr->tools[nTool];
 
 
     toolPtr = &infoPtr->tools[nTool];
 
-    if (!track_activate)
-        infoPtr->nCurrentTool = infoPtr->nTool;
-
-    TRACE("Show tooltip %d!\n", nTool);
+    TRACE("Show tooltip %d\n", nTool);
 
     hdr.hwndFrom = infoPtr->hwndSelf;
     hdr.idFrom = toolPtr->uId;
 
     hdr.hwndFrom = infoPtr->hwndSelf;
     hdr.idFrom = toolPtr->uId;
@@ -820,9 +824,9 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
     if (!track_activate)
     {
         SetTimer (infoPtr->hwndSelf, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
     if (!track_activate)
     {
         SetTimer (infoPtr->hwndSelf, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
-        TRACE("timer 2 started!\n");
+        TRACE("timer 2 started\n");
         SetTimer (infoPtr->hwndSelf, ID_TIMERLEAVE, infoPtr->nReshowTime, 0);
         SetTimer (infoPtr->hwndSelf, ID_TIMERLEAVE, infoPtr->nReshowTime, 0);
-        TRACE("timer 3 started!\n");
+        TRACE("timer 3 started\n");
     }
 }
 
     }
 }
 
@@ -833,7 +837,7 @@ TOOLTIPS_Hide (TOOLTIPS_INFO *infoPtr)
     TTTOOL_INFO *toolPtr;
     NMHDR hdr;
 
     TTTOOL_INFO *toolPtr;
     NMHDR hdr;
 
-    TRACE("Hide tooltip %d! (%p)\n", infoPtr->nCurrentTool, infoPtr->hwndSelf);
+    TRACE("Hide tooltip %d, %p.\n", infoPtr->nCurrentTool, infoPtr->hwndSelf);
 
     if (infoPtr->nCurrentTool == -1)
        return;
 
     if (infoPtr->nCurrentTool == -1)
        return;
@@ -942,8 +946,16 @@ TOOLTIPS_GetToolFromPoint (const TOOLTIPS_INFO *infoPtr, HWND hwnd, const POINT
 }
 
 static inline void
 }
 
 static inline void
-TOOLTIPS_CopyInfoT (const TTTOOL_INFO *toolPtr, TTTOOLINFOW *ti, BOOL isW)
+TOOLTIPS_CopyInfoT (const TOOLTIPS_INFO *infoPtr, INT index, TTTOOLINFOW *ti, BOOL isW)
 {
 {
+    const TTTOOL_INFO *toolPtr = &infoPtr->tools[index];
+
+    ti->uFlags = toolPtr->uFlags;
+    ti->hwnd   = toolPtr->hwnd;
+    ti->uId    = toolPtr->uId;
+    ti->rect   = toolPtr->rect;
+    ti->hinst  = toolPtr->hinst;
+
     if (ti->lpszText) {
         if (toolPtr->lpszText == NULL ||
             IS_INTRESOURCE(toolPtr->lpszText) ||
     if (ti->lpszText) {
         if (toolPtr->lpszText == NULL ||
             IS_INTRESOURCE(toolPtr->lpszText) ||
@@ -956,6 +968,11 @@ TOOLTIPS_CopyInfoT (const TTTOOL_INFO *toolPtr, TTTOOLINFOW *ti, BOOL isW)
             WideCharToMultiByte(CP_ACP, 0, toolPtr->lpszText, -1,
                                 (LPSTR)ti->lpszText, MAX_TEXT_SIZE_A, NULL, NULL);
     }
             WideCharToMultiByte(CP_ACP, 0, toolPtr->lpszText, -1,
                                 (LPSTR)ti->lpszText, MAX_TEXT_SIZE_A, NULL, NULL);
     }
+
+    if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
+        ti->lParam = toolPtr->lParam;
+
+    /* lpReserved is intentionally not set. */
 }
 
 static BOOL
 }
 
 static BOOL
@@ -1011,8 +1028,7 @@ TOOLTIPS_Activate (TOOLTIPS_INFO *infoPtr, BOOL activate)
 {
     infoPtr->bActive = activate;
 
 {
     infoPtr->bActive = activate;
 
-    if (infoPtr->bActive)
-       TRACE("activate!\n");
+    TRACE("activate %d\n", activate);
 
     if (!(infoPtr->bActive) && (infoPtr->nCurrentTool != -1))
        TOOLTIPS_Hide (infoPtr);
 
     if (!(infoPtr->bActive) && (infoPtr->nCurrentTool != -1))
        TOOLTIPS_Hide (infoPtr);
@@ -1029,9 +1045,8 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
 
     if (!ti) return FALSE;
 
 
     if (!ti) return FALSE;
 
-    TRACE("add tool (%p) %p %ld%s!\n",
-          infoPtr->hwndSelf, ti->hwnd, ti->uId,
-          (ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
+    TRACE("add tool (%p) %p %ld%s\n", infoPtr->hwndSelf, ti->hwnd, ti->uId,
+        (ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
 
     if (ti->cbSize >= TTTOOLINFOW_V2_SIZE && !ti->lpszText && isW)
         return FALSE;
 
     if (ti->cbSize >= TTTOOLINFOW_V2_SIZE && !ti->lpszText && isW)
         return FALSE;
@@ -1067,27 +1082,18 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
         }
         else if (ti->lpszText) {
             if (TOOLTIPS_IsCallbackString(ti->lpszText, isW)) {
         }
         else if (ti->lpszText) {
             if (TOOLTIPS_IsCallbackString(ti->lpszText, isW)) {
-                TRACE("add CALLBACK!\n");
+                TRACE("add CALLBACK\n");
                 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
             }
             else if (isW) {
                 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
             }
             else if (isW) {
-                __TRY
-                {
-                    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);
-                }
-                __EXCEPT_PAGE_FAULT
-                {
-                    WARN("Invalid lpszText.\n");
-                    return FALSE;
-                }
-                __ENDTRY
+                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);
             }
             else {
                 INT len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, NULL, 0);
-                TRACE("add text \"%s\"!\n", (LPSTR)ti->lpszText);
+                TRACE("add text \"%s\"\n", debugstr_a((char *)ti->lpszText));
                 toolPtr->lpszText =    Alloc (len * sizeof(WCHAR));
                 MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len);
             }
                 toolPtr->lpszText =    Alloc (len * sizeof(WCHAR));
                 MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len);
             }
@@ -1107,7 +1113,7 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
            SetWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1,
                              (DWORD_PTR)infoPtr->hwndSelf);
        }
            SetWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1,
                              (DWORD_PTR)infoPtr->hwndSelf);
        }
-       TRACE("subclassing installed!\n");
+       TRACE("subclassing installed\n");
     }
 
     nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
     }
 
     nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
@@ -1119,12 +1125,19 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
         toolPtr->bNotifyUnicode = TRUE;
        TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
     } else {
         toolPtr->bNotifyUnicode = TRUE;
        TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
     } else {
-        TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
+        TRACE (" -- WM_NOTIFYFORMAT returns: %d\n", nResult);
     }
 
     return TRUE;
 }
 
     }
 
     return TRUE;
 }
 
+static void TOOLTIPS_ResetSubclass (const TTTOOL_INFO *toolPtr)
+{
+    /* Reset subclassing data. */
+    if (toolPtr->uInternalFlags & TTF_SUBCLASS)
+        SetWindowSubclass(toolPtr->uInternalFlags & TTF_IDISHWND ? (HWND)toolPtr->uId : toolPtr->hwnd,
+            TOOLTIPS_SubclassProc, 1, 0);
+}
 
 static LRESULT
 TOOLTIPS_DelToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
 
 static LRESULT
 TOOLTIPS_DelToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
@@ -1157,15 +1170,7 @@ TOOLTIPS_DelToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
            Free (toolPtr->lpszText);
     }
 
            Free (toolPtr->lpszText);
     }
 
-    /* remove subclassing */
-    if (toolPtr->uInternalFlags & TTF_SUBCLASS) {
-       if (toolPtr->uInternalFlags & TTF_IDISHWND) {
-           RemoveWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1);
-       }
-       else {
-           RemoveWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1);
-       }
-    }
+    TOOLTIPS_ResetSubclass (toolPtr);
 
     /* delete tool from tool list */
     if (infoPtr->uNumTools == 1) {
 
     /* delete tool from tool list */
     if (infoPtr->uNumTools == 1) {
@@ -1218,28 +1223,14 @@ static LRESULT
 TOOLTIPS_EnumToolsT (const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti,
                      BOOL isW)
 {
 TOOLTIPS_EnumToolsT (const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti,
                      BOOL isW)
 {
-    TTTOOL_INFO *toolPtr;
-
-    if (!ti) return FALSE;
-    if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
+    if (!ti || ti->cbSize < TTTOOLINFOW_V1_SIZE)
        return FALSE;
     if (uIndex >= infoPtr->uNumTools)
        return FALSE;
 
     TRACE("index=%u\n", uIndex);
 
        return FALSE;
     if (uIndex >= infoPtr->uNumTools)
        return FALSE;
 
     TRACE("index=%u\n", uIndex);
 
-    toolPtr = &infoPtr->tools[uIndex];
-
-    /* copy tool data */
-    ti->uFlags   = toolPtr->uFlags;
-    ti->hwnd     = toolPtr->hwnd;
-    ti->uId      = toolPtr->uId;
-    ti->rect     = toolPtr->rect;
-    ti->hinst    = toolPtr->hinst;
-    TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
-
-    if (ti->cbSize >= TTTOOLINFOA_V2_SIZE)
-       ti->lParam = toolPtr->lParam;
+    TOOLTIPS_CopyInfoT (infoPtr, uIndex, ti, isW);
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -1269,31 +1260,15 @@ TOOLTIPS_GetBubbleSize (const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolI
 static LRESULT
 TOOLTIPS_GetCurrentToolT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
 {
 static LRESULT
 TOOLTIPS_GetCurrentToolT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
 {
-    TTTOOL_INFO *toolPtr;
-
     if (ti) {
         if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
             return FALSE;
 
     if (ti) {
         if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
             return FALSE;
 
-       if (infoPtr->nCurrentTool > -1) {
-           toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
-
-           /* copy tool data */
-           ti->uFlags   = toolPtr->uFlags;
-           ti->rect     = toolPtr->rect;
-           ti->hinst    = toolPtr->hinst;
-           TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
-
-           if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
-               ti->lParam = toolPtr->lParam;
-
-           return TRUE;
-       }
-       else
-           return FALSE;
+        if (infoPtr->nCurrentTool != -1)
+            TOOLTIPS_CopyInfoT (infoPtr, infoPtr->nCurrentTool, ti, isW);
     }
     }
-    else
-       return (infoPtr->nCurrentTool != -1);
+
+    return infoPtr->nCurrentTool != -1;
 }
 
 
 }
 
 
@@ -1398,8 +1373,8 @@ TOOLTIPS_GetToolCount (const TOOLTIPS_INFO *infoPtr)
 static LRESULT
 TOOLTIPS_GetToolInfoT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
 {
 static LRESULT
 TOOLTIPS_GetToolInfoT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
 {
-    TTTOOL_INFO *toolPtr;
     INT nTool;
     INT nTool;
+    HWND hwnd;
 
     if (!ti) return FALSE;
     if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
 
     if (!ti) return FALSE;
     if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
@@ -1413,16 +1388,9 @@ TOOLTIPS_GetToolInfoT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
 
     TRACE("tool %d\n", nTool);
 
 
     TRACE("tool %d\n", nTool);
 
-    toolPtr = &infoPtr->tools[nTool];
-
-    /* copy tool data */
-    ti->uFlags   = toolPtr->uFlags;
-    ti->rect     = toolPtr->rect;
-    ti->hinst    = toolPtr->hinst;
-    TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
-
-    if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
-       ti->lParam = toolPtr->lParam;
+    hwnd = ti->hwnd;
+    TOOLTIPS_CopyInfoT (infoPtr, nTool, ti, isW);
+    ti->hwnd = hwnd;
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -1432,7 +1400,6 @@ static LRESULT
 TOOLTIPS_HitTestT (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit,
                    BOOL isW)
 {
 TOOLTIPS_HitTestT (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit,
                    BOOL isW)
 {
-    TTTOOL_INFO *toolPtr;
     INT nTool;
 
     if (lptthit == 0)
     INT nTool;
 
     if (lptthit == 0)
@@ -1442,21 +1409,11 @@ TOOLTIPS_HitTestT (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit,
     if (nTool == -1)
        return FALSE;
 
     if (nTool == -1)
        return FALSE;
 
-    TRACE("tool %d!\n", nTool);
+    TRACE("tool %d\n", nTool);
 
     /* copy tool data */
 
     /* copy tool data */
-    if (lptthit->ti.cbSize >= TTTOOLINFOW_V1_SIZE) {
-       toolPtr = &infoPtr->tools[nTool];
-
-       lptthit->ti.uFlags   = toolPtr->uFlags;
-       lptthit->ti.hwnd     = toolPtr->hwnd;
-       lptthit->ti.uId      = toolPtr->uId;
-       lptthit->ti.rect     = toolPtr->rect;
-       lptthit->ti.hinst    = toolPtr->hinst;
-       TOOLTIPS_CopyInfoT (toolPtr, &lptthit->ti, isW);
-       if (lptthit->ti.cbSize >= TTTOOLINFOW_V2_SIZE)
-           lptthit->ti.lParam   = toolPtr->lParam;
-    }
+    if (lptthit->ti.cbSize >= TTTOOLINFOW_V1_SIZE)
+        TOOLTIPS_CopyInfoT (infoPtr, nTool, &lptthit->ti, isW);
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -1499,7 +1456,7 @@ TOOLTIPS_RelayEvent (TOOLTIPS_INFO *infoPtr, LPMSG lpMsg)
     INT nOldTool;
 
     if (!lpMsg) {
     INT nOldTool;
 
     if (!lpMsg) {
-       ERR("lpMsg == NULL!\n");
+       ERR("lpMsg == NULL\n");
        return 0;
     }
 
        return 0;
     }
 
@@ -1530,14 +1487,14 @@ TOOLTIPS_RelayEvent (TOOLTIPS_INFO *infoPtr, LPMSG lpMsg)
                } else if (nOldTool == -1) { /* Moved from outside */
                    if(infoPtr->bActive) {
                        SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
                } else if (nOldTool == -1) { /* Moved from outside */
                    if(infoPtr->bActive) {
                        SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
-                       TRACE("timer 1 started!\n");
+                        TRACE("timer 1 started\n");
                    }
                } else { /* Moved from one to another */
                    TOOLTIPS_Hide (infoPtr);
                    KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
                    if(infoPtr->bActive) {
                        SetTimer (infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
                    }
                } else { /* Moved from one to another */
                    TOOLTIPS_Hide (infoPtr);
                    KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
                    if(infoPtr->bActive) {
                        SetTimer (infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
-                       TRACE("timer 1 started!\n");
+                        TRACE("timer 1 started\n");
                    }
                }
            } else if(infoPtr->nCurrentTool != -1) { /* restart autopop */
                    }
                }
            } else if(infoPtr->nCurrentTool != -1) { /* restart autopop */
@@ -1547,7 +1504,7 @@ TOOLTIPS_RelayEvent (TOOLTIPS_INFO *infoPtr, LPMSG lpMsg)
            } else if(infoPtr->nTool != -1 && infoPtr->bActive) {
                 /* previous show attempt didn't result in tooltip so try again */
                SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
            } else if(infoPtr->nTool != -1 && infoPtr->bActive) {
                 /* previous show attempt didn't result in tooltip so try again */
                SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
-               TRACE("timer 1 started!\n");
+                TRACE("timer 1 started\n");
            }
            break;
     }
            }
            break;
     }
@@ -1703,7 +1660,7 @@ TOOLTIPS_SetToolInfoT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
     toolPtr->hinst  = ti->hinst;
 
     if (IS_INTRESOURCE(ti->lpszText)) {
     toolPtr->hinst  = ti->hinst;
 
     if (IS_INTRESOURCE(ti->lpszText)) {
-       TRACE("set string id %x!\n", LOWORD(ti->lpszText));
+       TRACE("set string id %x\n", LOWORD(ti->lpszText));
        toolPtr->lpszText = ti->lpszText;
     }
     else {
        toolPtr->lpszText = ti->lpszText;
     }
     else {
@@ -1762,7 +1719,7 @@ TOOLTIPS_TrackActivate (TOOLTIPS_INFO *infoPtr, BOOL track_activate, const TTTOO
        /* activate */
        infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoT (infoPtr, (const TTTOOLINFOW*)ti);
        if (infoPtr->nTrackTool != -1) {
        /* activate */
        infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoT (infoPtr, (const TTTOOLINFOW*)ti);
        if (infoPtr->nTrackTool != -1) {
-           TRACE("activated!\n");
+           TRACE("activated\n");
            infoPtr->bTrackActive = TRUE;
            TOOLTIPS_TrackShow (infoPtr);
        }
            infoPtr->bTrackActive = TRUE;
            TOOLTIPS_TrackShow (infoPtr);
        }
@@ -1774,7 +1731,7 @@ TOOLTIPS_TrackActivate (TOOLTIPS_INFO *infoPtr, BOOL track_activate, const TTTOO
        infoPtr->bTrackActive = FALSE;
        infoPtr->nTrackTool = -1;
 
        infoPtr->bTrackActive = FALSE;
        infoPtr->nTrackTool = -1;
 
-       TRACE("deactivated!\n");
+        TRACE("deactivated\n");
     }
 
     return 0;
     }
 
     return 0;
@@ -1919,16 +1876,9 @@ TOOLTIPS_Destroy (TOOLTIPS_INFO *infoPtr)
                }
            }
 
                }
            }
 
-           /* remove subclassing */
-        if (toolPtr->uInternalFlags & TTF_SUBCLASS) {
-            if (toolPtr->uInternalFlags & TTF_IDISHWND) {
-                RemoveWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1);
-            }
-            else {
-                RemoveWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1);
-            }
+            TOOLTIPS_ResetSubclass (toolPtr);
         }
         }
-    }
+
        Free (infoPtr->tools);
     }
 
        Free (infoPtr->tools);
     }
 
@@ -1997,7 +1947,7 @@ TOOLTIPS_NCHitTest (const TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
     if ((nTool > -1) && (nTool < infoPtr->uNumTools)) {
        if (infoPtr->tools[nTool].uFlags & TTF_TRANSPARENT) {
 
     if ((nTool > -1) && (nTool < infoPtr->uNumTools)) {
        if (infoPtr->tools[nTool].uFlags & TTF_TRANSPARENT) {
-           TRACE("-- in transparent mode!\n");
+           TRACE("-- in transparent mode\n");
            return HTTRANSPARENT;
        }
     }
            return HTTRANSPARENT;
        }
     }
@@ -2073,9 +2023,8 @@ TOOLTIPS_SetFont (TOOLTIPS_INFO *infoPtr, HFONT hFont, BOOL redraw)
     lf.lfWeight = FW_BOLD;
     infoPtr->hTitleFont = CreateFontIndirectW(&lf);
 
     lf.lfWeight = FW_BOLD;
     infoPtr->hTitleFont = CreateFontIndirectW(&lf);
 
-    if (redraw && infoPtr->nCurrentTool != -1) {
-       FIXME("full redraw needed!\n");
-    }
+    if (redraw && infoPtr->nCurrentTool != -1)
+        FIXME("full redraw needed\n");
 
     return 0;
 }
 
     return 0;
 }
@@ -2124,7 +2073,7 @@ TOOLTIPS_Timer (TOOLTIPS_INFO *infoPtr, INT iTimer)
 {
     INT nOldTool;
 
 {
     INT nOldTool;
 
-    TRACE("timer %d (%p) expired!\n", iTimer, infoPtr->hwndSelf);
+    TRACE("timer %d (%p) expired\n", iTimer, infoPtr->hwndSelf);
 
     switch (iTimer) {
     case ID_TIMERSHOW:
 
     switch (iTimer) {
     case ID_TIMERSHOW:
@@ -2178,12 +2127,13 @@ TOOLTIPS_WinIniChange (TOOLTIPS_INFO *infoPtr)
 
 
 static LRESULT CALLBACK
 
 
 static LRESULT CALLBACK
-TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
+TOOLTIPS_SubclassProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr ((HWND)dwRef);
     MSG msg;
 
 {
     TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr ((HWND)dwRef);
     MSG msg;
 
-    switch(uMsg) {
+    switch (message)
+    {
     case WM_MOUSEMOVE:
     case WM_LBUTTONDOWN:
     case WM_LBUTTONUP:
     case WM_MOUSEMOVE:
     case WM_LBUTTONDOWN:
     case WM_LBUTTONUP:
@@ -2191,17 +2141,23 @@ TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_
     case WM_MBUTTONUP:
     case WM_RBUTTONDOWN:
     case WM_RBUTTONUP:
     case WM_MBUTTONUP:
     case WM_RBUTTONDOWN:
     case WM_RBUTTONUP:
-        msg.hwnd = hwnd;
-       msg.message = uMsg;
-       msg.wParam = wParam;
-       msg.lParam = lParam;
-       TOOLTIPS_RelayEvent(infoPtr, &msg);
-       break;
-
+        if (infoPtr)
+        {
+            msg.hwnd = hwnd;
+            msg.message = message;
+            msg.wParam = wParam;
+            msg.lParam = lParam;
+            TOOLTIPS_RelayEvent(infoPtr, &msg);
+        }
+        break;
+    case WM_NCDESTROY:
+        RemoveWindowSubclass(hwnd, TOOLTIPS_SubclassProc, 1);
+        break;
     default:
         break;
     }
     default:
         break;
     }
-    return DefSubclassProc(hwnd, uMsg, wParam, lParam);
+
+    return DefSubclassProc(hwnd, message, wParam, lParam);
 }
 
 
 }
 
 
index 9aff605..0a53c7b 100644 (file)
@@ -607,11 +607,11 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
     RECT  budRect;  /* new coord for the buddy */
     int   x, width;  /* new x position and width for the up-down */
     WCHAR buddyClass[40];
     RECT  budRect;  /* new coord for the buddy */
     int   x, width;  /* new x position and width for the up-down */
     WCHAR buddyClass[40];
-    HWND ret;
+    HWND old_buddy;
 
     TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud);
 
 
     TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud);
 
-    ret = infoPtr->Buddy;
+    old_buddy = infoPtr->Buddy;
 
     /* there is already a buddy assigned */
     if (infoPtr->Buddy) RemoveWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc,
 
     /* there is already a buddy assigned */
     if (infoPtr->Buddy) RemoveWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc,
@@ -648,7 +648,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
             x  = budRect.right+DEFAULT_XSEP;
         } else {
             /* nothing to do */
             x  = budRect.right+DEFAULT_XSEP;
         } else {
             /* nothing to do */
-            return ret;
+            return old_buddy;
         }
 
         /* first adjust the buddy to accommodate the up/down */
         }
 
         /* first adjust the buddy to accommodate the up/down */
@@ -677,14 +677,15 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
                      budRect.top - DEFAULT_ADDTOP, width,
                      budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
                      SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
                      budRect.top - DEFAULT_ADDTOP, width,
                      budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
                      SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
-    } else {
+    } else if (!(infoPtr->dwStyle & UDS_HORZ) && old_buddy != NULL) {
         RECT rect;
         GetWindowRect(infoPtr->Self, &rect);
         MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Self), (POINT *)&rect, 2);
         SetWindowPos(infoPtr->Self, 0, rect.left, rect.top, DEFAULT_WIDTH, rect.bottom - rect.top,
                      SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
     }
         RECT rect;
         GetWindowRect(infoPtr->Self, &rect);
         MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Self), (POINT *)&rect, 2);
         SetWindowPos(infoPtr->Self, 0, rect.left, rect.top, DEFAULT_WIDTH, rect.bottom - rect.top,
                      SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
     }
-    return ret;
+
+    return old_buddy;
 }
 
 /***********************************************************************
 }
 
 /***********************************************************************
index 3910789..270a296 100644 (file)
@@ -54,7 +54,7 @@ reactos/dll/win32/browseui            # Out of sync
 reactos/dll/win32/cabinet             # Synced to WineStaging-2.9
 reactos/dll/win32/clusapi             # Synced to WineStaging-2.9
 reactos/dll/win32/comcat              # Synced to WineStaging-2.9
 reactos/dll/win32/cabinet             # Synced to WineStaging-2.9
 reactos/dll/win32/clusapi             # Synced to WineStaging-2.9
 reactos/dll/win32/comcat              # Synced to WineStaging-2.9
-reactos/dll/win32/comctl32            # Synced to WineStaging-2.16
+reactos/dll/win32/comctl32            # Synced to Wine-3.0
 reactos/dll/win32/comdlg32            # Synced to WineStaging-2.16
 reactos/dll/win32/compstui            # Synced to WineStaging-2.9
 reactos/dll/win32/credui              # Synced to WineStaging-2.9
 reactos/dll/win32/comdlg32            # Synced to WineStaging-2.16
 reactos/dll/win32/compstui            # Synced to WineStaging-2.9
 reactos/dll/win32/credui              # Synced to WineStaging-2.9