[05/13] comctl32/toolbar: Retrieve control data once at WinProc (resent)

Nikolay Sivov bunglehead at gmail.com
Mon May 18 13:52:59 CDT 2009


Don't see it on list so resent.

This will remove lot of unneeded GetWindowLongPtr calls.

Changelog:
    - Retrieve control data once at WinProc

>From a37d9b69ba2db23d96008af82b4c471a4f342341 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Mon, 18 May 2009 19:27:15 +0400
Subject: Retrieve control data once at WinProc

---
 dlls/comctl32/toolbar.c |  975 ++++++++++++++++++++---------------------------
 1 files changed, 419 insertions(+), 556 deletions(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 867bac8..d47a611 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -217,7 +217,6 @@ typedef enum
 
 #define TOOLBAR_NOWHERE (-1)
 
-#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongPtrW(hwnd,0))
 #define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE)
 #define TOOLBAR_HasDropDownArrows(exStyle) ((exStyle & TBSTYLE_EX_DRAWDDARROWS) ? TRUE : FALSE)
 
@@ -246,10 +245,10 @@ static HIMAGELIST TOOLBAR_GetImageList(const PIMLENTRY *pies, INT cies, INT id);
 static PIMLENTRY TOOLBAR_GetImageListEntry(const PIMLENTRY *pies, INT cies, INT id);
 static VOID TOOLBAR_DeleteImageList(PIMLENTRY **pies, INT *cies);
 static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id);
-static LRESULT TOOLBAR_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam);
+static LRESULT TOOLBAR_LButtonDown(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
 static void TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason);
-static void TOOLBAR_LayoutToolbar(HWND hwnd);
-static LRESULT TOOLBAR_AutoSize(HWND hwnd);
+static void TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr);
+static LRESULT TOOLBAR_AutoSize(TOOLBAR_INFO *infoPtr);
 static void TOOLBAR_CheckImageListIconSize(TOOLBAR_INFO *infoPtr);
 static void TOOLBAR_TooltipAddTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button);
 static void TOOLBAR_TooltipSetRect(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button);
@@ -328,10 +327,10 @@ TOOLBAR_DumpToolbar(const TOOLBAR_INFO *iP, INT line)
 * function should be null.
 */
 static void
-TOOLBAR_CheckStyle (HWND hwnd, DWORD dwStyle)
+TOOLBAR_CheckStyle (const TOOLBAR_INFO *infoPtr, DWORD dwStyle)
 {
     if (dwStyle & TBSTYLE_REGISTERDROP)
-	FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", hwnd);
+	FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", infoPtr->hwndSelf);
 }
 

@@ -818,9 +817,8 @@ TOOLBAR_DrawSepDDArrow(const TOOLBAR_INFO *infoPtr, const NMTBCUSTOMDRAW *tbcd,
 
 /* draws a complete toolbar button */
 static void
-TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDraw)
+TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDraw)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     DWORD dwStyle = infoPtr->dwStyle;
     BOOL hasDropDownArrow = (TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) &&
                             (btnPtr->fsStyle & BTNS_DROPDOWN)) ||
@@ -835,7 +833,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDr
     INT oldBkMode;
     DWORD dwItemCustDraw;
     DWORD dwItemCDFlag;
-    HTHEME theme = GetWindowTheme (hwnd);
+    HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
 
     rc = btnPtr->rect;
     CopyRect (&rcArrow, &rc);
@@ -1081,9 +1079,8 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDr
 

 static void
-TOOLBAR_Refresh (HWND hwnd, HDC hdc, const PAINTSTRUCT *ps)
+TOOLBAR_Refresh (TOOLBAR_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT i;
     RECT rcTemp, rcClient;
@@ -1117,7 +1114,7 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, const PAINTSTRUCT *ps)
     ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW);
     dwBaseCustDraw = ntfret & 0xffff;
 
-    GetClientRect(hwnd, &rcClient);
+    GetClientRect(infoPtr->hwndSelf, &rcClient);
 
     /* redraw necessary buttons */
     btnPtr = infoPtr->buttons;
@@ -1136,7 +1133,7 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, const PAINTSTRUCT *ps)
         bDraw &= IntersectRect(&rcTemp, &(ps->rcPaint), &(btnPtr->rect));
         bDraw = (btnPtr->fsState & TBSTATE_HIDDEN) ? FALSE : bDraw;
         if (bDraw)
-            TOOLBAR_DrawButton(hwnd, btnPtr, hdc, dwBaseCustDraw);
+            TOOLBAR_DrawButton(infoPtr, btnPtr, hdc, dwBaseCustDraw);
     }
 
     /* draw insert mark if required */
@@ -1221,9 +1218,8 @@ TOOLBAR_MeasureString(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr,
 * the largest height and width to caller.
 */
 static void
-TOOLBAR_CalcStrings (HWND hwnd, LPSIZE lpSize)
+TOOLBAR_CalcStrings (const TOOLBAR_INFO *infoPtr, LPSIZE lpSize)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT i;
     SIZE sz;
@@ -1236,7 +1232,7 @@ TOOLBAR_CalcStrings (HWND hwnd, LPSIZE lpSize)
     if (infoPtr->nMaxTextRows == 0)
         return;
 
-    hdc = GetDC (hwnd);
+    hdc = GetDC (infoPtr->hwndSelf);
     hOldFont = SelectObject (hdc, infoPtr->hFont);
 
     if (infoPtr->nNumButtons == 0 && infoPtr->nNumStrings > 0)
@@ -1260,7 +1256,7 @@ TOOLBAR_CalcStrings (HWND hwnd, LPSIZE lpSize)
     }
 
     SelectObject (hdc, hOldFont);
-    ReleaseDC (hwnd, hdc);
+    ReleaseDC (infoPtr->hwndSelf, hdc);
 
     TRACE("max string size %d x %d!\n", lpSize->cx, lpSize->cy);
 }
@@ -1281,9 +1277,8 @@ TOOLBAR_CalcStrings (HWND hwnd, LPSIZE lpSize)
 */
 
 static void
-TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
+TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT x, cx, i, j;
     RECT rc;
@@ -1292,24 +1287,24 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
     /* 	When the toolbar window style is not TBSTYLE_WRAPABLE,	*/
     /*	no layout is necessary. Applications may use this style */
     /*	to perform their own layout on the toolbar. 		*/
-    if( !(dwStyle & TBSTYLE_WRAPABLE) &&
+    if( !(infoPtr->dwStyle & TBSTYLE_WRAPABLE) &&
 	!(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) )  return;
 
     btnPtr = infoPtr->buttons;
     x  = infoPtr->nIndent;
 
-    if (GetParent(hwnd))
+    if (GetParent(infoPtr->hwndSelf))
     {
         /* this can get the parents width, to know how far we can extend
          * this toolbar.  We cannot use its height, as there may be multiple
          * toolbars in a rebar control
          */
-        GetClientRect( GetParent(hwnd), &rc );
+        GetClientRect( GetParent(infoPtr->hwndSelf), &rc );
         infoPtr->nWidth = rc.right - rc.left;
     }
     else
     {
-        GetWindowRect( hwnd, &rc );
+        GetWindowRect( infoPtr->hwndSelf, &rc );
         infoPtr->nWidth = rc.right - rc.left;
     }
 
@@ -1615,13 +1610,12 @@ static inline SIZE TOOLBAR_MeasureButton(const TOOLBAR_INFO *infoPtr, SIZE sizeS
 * rect and calculates the new required toolbar window height.
 */
 static void
-TOOLBAR_CalcToolbar (HWND hwnd)
+TOOLBAR_CalcToolbar (TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     SIZE  sizeString, sizeButton;
     BOOL validImageList = FALSE;
 
-    TOOLBAR_CalcStrings (hwnd, &sizeString);
+    TOOLBAR_CalcStrings (infoPtr, &sizeString);
 
     TOOLBAR_DumpToolbar (infoPtr, __LINE__);
 
@@ -1637,13 +1631,12 @@ TOOLBAR_CalcToolbar (HWND hwnd)
     if ( infoPtr->cxMax > 0 && infoPtr->nButtonWidth > infoPtr->cxMax )
         infoPtr->nButtonWidth = infoPtr->cxMax;
 
-    TOOLBAR_LayoutToolbar(hwnd);
+    TOOLBAR_LayoutToolbar(infoPtr);
 }
 
 static void
-TOOLBAR_LayoutToolbar(HWND hwnd)
+TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     TBUTTON_INFO *btnPtr;
     SIZE sizeButton;
     INT i, nRows, nSepRows;
@@ -1652,7 +1645,7 @@ TOOLBAR_LayoutToolbar(HWND hwnd)
     BOOL validImageList = TOOLBAR_IsValidImageList(infoPtr, 0);
     BOOL hasDropDownArrows = TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle);
 
-    TOOLBAR_WrapToolbar(hwnd, infoPtr->dwStyle);
+    TOOLBAR_WrapToolbar(infoPtr);
 
     x  = infoPtr->nIndent;
     y  = infoPtr->iTopMargin;
@@ -1701,13 +1694,13 @@ TOOLBAR_LayoutToolbar(HWND hwnd)
 	      HDC hdc;
 	      HFONT hOldFont;
 
-	      hdc = GetDC (hwnd);
+	      hdc = GetDC (infoPtr->hwndSelf);
 	      hOldFont = SelectObject (hdc, infoPtr->hFont);
 
               TOOLBAR_MeasureString(infoPtr, btnPtr, hdc, &sz);
 
 	      SelectObject (hdc, hOldFont);
-	      ReleaseDC (hwnd, hdc);
+	      ReleaseDC (infoPtr->hwndSelf, hdc);
 
               sizeButton = TOOLBAR_MeasureButton(infoPtr, sz,
                   TOOLBAR_IsValidBitmapIndex(infoPtr, infoPtr->buttons[i].iBitmap),
@@ -1780,9 +1773,8 @@ TOOLBAR_LayoutToolbar(HWND hwnd)
 

 static INT
-TOOLBAR_InternalHitTest (HWND hwnd, const POINT *lpPt)
+TOOLBAR_InternalHitTest (TOOLBAR_INFO *infoPtr, const POINT *lpPt)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT i;
 
@@ -1858,10 +1850,10 @@ TOOLBAR_InternalInsertButtonsT(TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButto
     }
 
     if (infoPtr->nNumStrings > 0 || fHasString)
-        TOOLBAR_CalcToolbar(infoPtr->hwndSelf);
+        TOOLBAR_CalcToolbar(infoPtr);
     else
-        TOOLBAR_LayoutToolbar(infoPtr->hwndSelf);
-    TOOLBAR_AutoSize(infoPtr->hwndSelf);
+        TOOLBAR_LayoutToolbar(infoPtr);
+    TOOLBAR_AutoSize(infoPtr);
 
     TOOLBAR_DumpToolbar(infoPtr, __LINE__);
     InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
@@ -2778,15 +2770,14 @@ TOOLBAR_CheckImageListIconSize(TOOLBAR_INFO *infoPtr)
  *
  */
 static LRESULT
-TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPTBADDBITMAP lpAddBmp = (LPTBADDBITMAP)lParam;
     TBITMAP_INFO info;
     INT iSumButtons, i;
     HIMAGELIST himlDef;
 
-    TRACE("hwnd=%p wParam=%lx lParam=%lx\n", hwnd, wParam, lParam);
+    TRACE("hwnd=%p wParam=%lx lParam=%lx\n", infoPtr->hwndSelf, wParam, lParam);
     if (!lpAddBmp)
 	return -1;
 
@@ -2829,15 +2820,15 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
 	if (lpAddBmp->nID & 1)
 	{
 	    /* large icons: 24x24. Will make the button 31x30 */
-	    SendMessageW (hwnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(24, 24));
+	    SendMessageW (infoPtr->hwndSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(24, 24));
 	}
 	else
 	{
 	    /* small icons: 16x16. Will make the buttons 23x22 */
-	    SendMessageW (hwnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
+	    SendMessageW (infoPtr->hwndSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
 	}
 
-	TOOLBAR_CalcToolbar (hwnd);
+	TOOLBAR_CalcToolbar (infoPtr);
     }
     else
     {
@@ -2884,15 +2875,14 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
     infoPtr->nNumBitmapInfos++;
     TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
 
-    InvalidateRect(hwnd, NULL, TRUE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return iSumButtons;
 }
 

 static LRESULT
-TOOLBAR_AddButtonsT(HWND hwnd, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
+TOOLBAR_AddButtonsT(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPTBBUTTON lpTbb = (LPTBBUTTON)lParam;
     INT nAddButtons = (UINT)wParam;
 
@@ -2903,10 +2893,9 @@ TOOLBAR_AddButtonsT(HWND hwnd, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
 

 static LRESULT
-TOOLBAR_AddStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_AddStringW (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
 #define MAX_RESOURCE_STRING_LENGTH 512
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     BOOL fFirstString = (infoPtr->nNumStrings == 0);
     INT nIndex = infoPtr->nNumStrings;
 
@@ -2965,22 +2954,21 @@ TOOLBAR_AddStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
     }
 
     if (fFirstString)
-        TOOLBAR_CalcToolbar(hwnd);
+        TOOLBAR_CalcToolbar(infoPtr);
     return nIndex;
 }
 

 static LRESULT
-TOOLBAR_AddStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_AddStringA (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     BOOL fFirstString = (infoPtr->nNumStrings == 0);
     LPSTR p;
     INT nIndex;
     INT len;
 
     if ((wParam) && (HIWORD(lParam) == 0))  /* load from resources */
-        return TOOLBAR_AddStringW(hwnd, wParam, lParam);
+        return TOOLBAR_AddStringW(infoPtr, wParam, lParam);
 
     p = (LPSTR)lParam;
     if (p == NULL)
@@ -3000,15 +2988,14 @@ TOOLBAR_AddStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
     }
 
     if (fFirstString)
-        TOOLBAR_CalcToolbar(hwnd);
+        TOOLBAR_CalcToolbar(infoPtr);
     return nIndex;
 }
 

 static LRESULT
-TOOLBAR_AutoSize (HWND hwnd)
+TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     RECT parent_rect;
     HWND parent;
     INT  x, y;
@@ -3016,7 +3003,7 @@ TOOLBAR_AutoSize (HWND hwnd)
 
     TRACE("auto sizing, style=%x!\n", infoPtr->dwStyle);
 
-    parent = GetParent (hwnd);
+    parent = GetParent (infoPtr->hwndSelf);
 
     if (!parent || !infoPtr->bDoRedraw)
         return 0;
@@ -3033,8 +3020,8 @@ TOOLBAR_AutoSize (HWND hwnd)
 
     if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1))
     {
-        TOOLBAR_LayoutToolbar(hwnd);
-        InvalidateRect( hwnd, NULL, TRUE );
+        TOOLBAR_LayoutToolbar(infoPtr);
+        InvalidateRect( infoPtr->hwndSelf, NULL, TRUE );
     }
 
     if (!(infoPtr->dwStyle & CCS_NORESIZE))
@@ -3044,13 +3031,13 @@ TOOLBAR_AutoSize (HWND hwnd)
 
         if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_NOMOVEY)
         {
-            GetWindowRect(hwnd, &window_rect);
+            GetWindowRect(infoPtr->hwndSelf, &window_rect);
             ScreenToClient(parent, (LPPOINT)&window_rect.left);
             y = window_rect.top;
         }
         if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_BOTTOM)
         {
-            GetWindowRect(hwnd, &window_rect);
+            GetWindowRect(infoPtr->hwndSelf, &window_rect);
             y = parent_rect.bottom - ( window_rect.bottom - window_rect.top);
         }
 
@@ -3067,7 +3054,7 @@ TOOLBAR_AutoSize (HWND hwnd)
             cx += GetSystemMetrics(SM_CXEDGE);
         }
 
-        SetWindowPos(hwnd, NULL, x, y, cx, cy, uPosFlags);
+        SetWindowPos(infoPtr->hwndSelf, NULL, x, y, cx, cy, uPosFlags);
     }
 
     return 0;
@@ -3075,19 +3062,15 @@ TOOLBAR_AutoSize (HWND hwnd)
 

 static LRESULT
-TOOLBAR_ButtonCount (HWND hwnd)
+TOOLBAR_ButtonCount (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     return infoPtr->nNumButtons;
 }
 

 static LRESULT
-TOOLBAR_ButtonStructSize (HWND hwnd, WPARAM wParam)
+TOOLBAR_ButtonStructSize (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     infoPtr->dwStructSize = (DWORD)wParam;
 
     return 0;
@@ -3095,9 +3078,8 @@ TOOLBAR_ButtonStructSize (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_ChangeBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_ChangeBitmap (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT nIndex;
 
@@ -3112,16 +3094,15 @@ TOOLBAR_ChangeBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     /* we HAVE to erase the background, the new bitmap could be */
     /* transparent */
-    InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+    InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
 
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_CheckButton (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT nIndex;
     INT nOldIndex = -1;
@@ -3129,7 +3110,7 @@ TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
 
-    TRACE("hwnd=%p, btn index=%d, lParam=0x%08lx\n", hwnd, nIndex, lParam);
+    TRACE("hwnd=%p, btn index=%d, lParam=0x%08lx\n", infoPtr->hwndSelf, nIndex, lParam);
 
     if (nIndex == -1)
 	return FALSE;
@@ -3155,8 +3136,8 @@ TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
     if( bChecked != LOWORD(lParam) )
     {
         if (nOldIndex != -1)
-            InvalidateRect(hwnd, &infoPtr->buttons[nOldIndex].rect, TRUE);
-        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+            InvalidateRect(infoPtr->hwndSelf, &infoPtr->buttons[nOldIndex].rect, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
     }
 
     /* FIXME: Send a WM_NOTIFY?? */
@@ -3166,18 +3147,15 @@ TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_CommandToIndex (HWND hwnd, WPARAM wParam)
+TOOLBAR_CommandToIndex (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     return TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
 }
 

 static LRESULT
-TOOLBAR_Customize (HWND hwnd)
+TOOLBAR_Customize (TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     CUSTDLG_INFO custInfo;
     LRESULT ret;
     LPCVOID template;
@@ -3185,7 +3163,7 @@ TOOLBAR_Customize (HWND hwnd)
     NMHDR nmhdr;
 
     custInfo.tbInfo = infoPtr;
-    custInfo.tbHwnd = hwnd;
+    custInfo.tbHwnd = infoPtr->hwndSelf;
 
     /* send TBN_BEGINADJUST notification */
     TOOLBAR_SendNotify (&nmhdr, infoPtr, TBN_BEGINADJUST);
@@ -3198,8 +3176,8 @@ TOOLBAR_Customize (HWND hwnd)
     if(!(template = LoadResource (COMCTL32_hModule, hRes)))
 	return FALSE;
 
-    ret = DialogBoxIndirectParamW ((HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE),
-                                   template, hwnd, TOOLBAR_CustomizeDialogProc,
+    ret = DialogBoxIndirectParamW ((HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE),
+                                   template, infoPtr->hwndSelf, TOOLBAR_CustomizeDialogProc,
                                    (LPARAM)&custInfo);
 
     /* send TBN_ENDADJUST notification */
@@ -3210,9 +3188,8 @@ TOOLBAR_Customize (HWND hwnd)
 

 static LRESULT
-TOOLBAR_DeleteButton (HWND hwnd, WPARAM wParam)
+TOOLBAR_DeleteButton (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex = (INT)wParam;
     NMTOOLBARW nmtb;
     TBUTTON_INFO *btnPtr = &infoPtr->buttons[nIndex];
@@ -3257,25 +3234,24 @@ TOOLBAR_DeleteButton (HWND hwnd, WPARAM wParam)
 	Free (oldButtons);
     }
 
-    TOOLBAR_LayoutToolbar(hwnd);
+    TOOLBAR_LayoutToolbar(infoPtr);
 
-    InvalidateRect (hwnd, NULL, TRUE);
+    InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
 
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_EnableButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_EnableButton (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT nIndex;
     DWORD bState;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
 
-    TRACE("hwnd=%p, btn index=%ld, lParam=0x%08lx\n", hwnd, wParam, lParam);
+    TRACE("hwnd=%p, btn index=%ld, lParam=0x%08lx\n", infoPtr->hwndSelf, wParam, lParam);
 
     if (nIndex == -1)
 	return FALSE;
@@ -3293,25 +3269,22 @@ TOOLBAR_EnableButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     /* redraw the button only if the state of the button changed */
     if(bState != (btnPtr->fsState & TBSTATE_ENABLED))
-        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
 
     return TRUE;
 }
 

 static inline LRESULT
-TOOLBAR_GetAnchorHighlight (HWND hwnd)
+TOOLBAR_GetAnchorHighlight (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     return infoPtr->bAnchor;
 }
 

 static LRESULT
-TOOLBAR_GetBitmap (HWND hwnd, WPARAM wParam)
+TOOLBAR_GetBitmap (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
@@ -3330,9 +3303,8 @@ TOOLBAR_GetBitmapFlags (void)
 

 static LRESULT
-TOOLBAR_GetButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetButton (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPTBBUTTON lpTbb = (LPTBBUTTON)lParam;
     INT nIndex = (INT)wParam;
     TBUTTON_INFO *btnPtr;
@@ -3358,9 +3330,8 @@ TOOLBAR_GetButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetButtonInfoT(HWND hwnd, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
+TOOLBAR_GetButtonInfoT(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     /* TBBUTTONINFOW and TBBUTTONINFOA have the same layout*/
     LPTBBUTTONINFOW lpTbInfo = (LPTBBUTTONINFOW)lParam;
     TBUTTON_INFO *btnPtr;
@@ -3419,19 +3390,16 @@ TOOLBAR_GetButtonInfoT(HWND hwnd, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
 

 static LRESULT
-TOOLBAR_GetButtonSize (HWND hwnd)
+TOOLBAR_GetButtonSize (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     return MAKELONG((WORD)infoPtr->nButtonWidth,
                     (WORD)infoPtr->nButtonHeight);
 }
 

 static LRESULT
-TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetButtonTextA (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
     LPWSTR lpText;
 
@@ -3447,9 +3415,8 @@ TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetButtonTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetButtonTextW (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
     LPWSTR lpText;
     LRESULT ret = 0;
@@ -3473,19 +3440,17 @@ TOOLBAR_GetButtonTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetDisabledImageList (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TRACE("hwnd=%p, wParam=%ld, lParam=0x%lx\n", hwnd, wParam, lParam);
+    TRACE("hwnd=%p, wParam=%ld, lParam=0x%lx\n", infoPtr->hwndSelf, wParam, lParam);
     /* UNDOCUMENTED: wParam is actually the ID of the image list to return */
-    return (LRESULT)GETDISIMAGELIST(TOOLBAR_GetInfoPtr (hwnd), wParam);
+    return (LRESULT)GETDISIMAGELIST(infoPtr, wParam);
 }
 

 static inline LRESULT
-TOOLBAR_GetExtendedStyle (HWND hwnd)
+TOOLBAR_GetExtendedStyle (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     TRACE("\n");
 
     return infoPtr->dwExStyle;
@@ -3493,19 +3458,17 @@ TOOLBAR_GetExtendedStyle (HWND hwnd)
 

 static LRESULT
-TOOLBAR_GetHotImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetHotImageList (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TRACE("hwnd=%p, wParam=%ld, lParam=0x%lx\n", hwnd, wParam, lParam);
+    TRACE("hwnd=%p, wParam=%ld, lParam=0x%lx\n", infoPtr->hwndSelf, wParam, lParam);
     /* UNDOCUMENTED: wParam is actually the ID of the image list to return */
-    return (LRESULT)GETHOTIMAGELIST(TOOLBAR_GetInfoPtr (hwnd), wParam);
+    return (LRESULT)GETHOTIMAGELIST(infoPtr, wParam);
 }
 

 static LRESULT
-TOOLBAR_GetHotItem (HWND hwnd)
+TOOLBAR_GetHotItem (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     if (!((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)))
 	return -1;
 
@@ -3517,21 +3480,20 @@ TOOLBAR_GetHotItem (HWND hwnd)
 

 static LRESULT
-TOOLBAR_GetDefImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetDefImageList (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TRACE("hwnd=%p, wParam=%ld, lParam=0x%lx\n", hwnd, wParam, lParam);
+    TRACE("hwnd=%p, wParam=%ld, lParam=0x%lx\n", infoPtr->hwndSelf, wParam, lParam);
     /* UNDOCUMENTED: wParam is actually the ID of the image list to return */
-    return (LRESULT) GETDEFIMAGELIST(TOOLBAR_GetInfoPtr(hwnd), wParam);
+    return (LRESULT) GETDEFIMAGELIST(infoPtr, wParam);
 }
 

 static LRESULT
-TOOLBAR_GetInsertMark (HWND hwnd, LPARAM lParam)
+TOOLBAR_GetInsertMark (const TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBINSERTMARK *lptbim = (TBINSERTMARK*)lParam;
 
-    TRACE("hwnd = %p, lptbim = %p\n", hwnd, lptbim);
+    TRACE("hwnd = %p, lptbim = %p\n", infoPtr->hwndSelf, lptbim);
 
     *lptbim = infoPtr->tbim;
 
@@ -3540,20 +3502,17 @@ TOOLBAR_GetInsertMark (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetInsertMarkColor (HWND hwnd)
+TOOLBAR_GetInsertMarkColor (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
-    TRACE("hwnd = %p\n", hwnd);
+    TRACE("hwnd = %p\n", infoPtr->hwndSelf);
 
     return (LRESULT)infoPtr->clrInsertMark;
 }
 

 static LRESULT
-TOOLBAR_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetItemRect (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     LPRECT     lpRect;
     INT        nIndex;
@@ -3578,9 +3537,8 @@ TOOLBAR_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetMaxSize (HWND hwnd, LPARAM lParam)
+TOOLBAR_GetMaxSize (const TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPSIZE lpSize = (LPSIZE)lParam;
 
     if (lpSize == NULL)
@@ -3601,9 +3559,8 @@ TOOLBAR_GetMaxSize (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetPadding (HWND hwnd)
+TOOLBAR_GetPadding (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     DWORD oldPad;
 
     oldPad = MAKELONG(infoPtr->szPadding.cx, infoPtr->szPadding.cy);
@@ -3612,9 +3569,8 @@ TOOLBAR_GetPadding (HWND hwnd)
 

 static LRESULT
-TOOLBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetRect (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     LPRECT     lpRect;
     INT        nIndex;
@@ -3637,18 +3593,15 @@ TOOLBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetRows (HWND hwnd)
+TOOLBAR_GetRows (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     return infoPtr->nRows;
 }
 

 static LRESULT
-TOOLBAR_GetState (HWND hwnd, WPARAM wParam)
+TOOLBAR_GetState (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
@@ -3660,26 +3613,22 @@ TOOLBAR_GetState (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_GetStyle (HWND hwnd)
+TOOLBAR_GetStyle (const TOOLBAR_INFO *infoPtr)
 {
-    return GetWindowLongW(hwnd, GWL_STYLE);
+    return GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
 }
 

 static LRESULT
-TOOLBAR_GetTextRows (HWND hwnd)
+TOOLBAR_GetTextRows (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     return infoPtr->nMaxTextRows;
 }
 

 static LRESULT
-TOOLBAR_GetToolTips (HWND hwnd)
+TOOLBAR_GetToolTips (TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     if ((infoPtr->dwStyle & TBSTYLE_TOOLTIPS) && (infoPtr->hwndToolTip == NULL))
         TOOLBAR_TooltipCreateControl(infoPtr);
     return (LRESULT)infoPtr->hwndToolTip;
@@ -3687,29 +3636,25 @@ TOOLBAR_GetToolTips (HWND hwnd)
 

 static LRESULT
-TOOLBAR_GetUnicodeFormat (HWND hwnd)
+TOOLBAR_GetUnicodeFormat (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     TRACE("%s hwnd=%p\n",
-	   infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);
+	   infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);
 
     return infoPtr->bUnicode;
 }
 

 static inline LRESULT
-TOOLBAR_GetVersion (HWND hwnd)
+TOOLBAR_GetVersion (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     return infoPtr->iVersion;
 }
 

 static LRESULT
-TOOLBAR_HideButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_HideButton (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT nIndex;
 
@@ -3725,25 +3670,24 @@ TOOLBAR_HideButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
     else
 	btnPtr->fsState |= TBSTATE_HIDDEN;
 
-    TOOLBAR_LayoutToolbar (hwnd);
+    TOOLBAR_LayoutToolbar (infoPtr);
 
-    InvalidateRect (hwnd, NULL, TRUE);
+    InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
 
     return TRUE;
 }
 

 static inline LRESULT
-TOOLBAR_HitTest (HWND hwnd, LPARAM lParam)
+TOOLBAR_HitTest (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    return TOOLBAR_InternalHitTest (hwnd, (LPPOINT)lParam);
+    return TOOLBAR_InternalHitTest (infoPtr, (LPPOINT)lParam);
 }
 

 static LRESULT
-TOOLBAR_Indeterminate (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_Indeterminate (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT nIndex;
     DWORD oldState;
@@ -3760,16 +3704,15 @@ TOOLBAR_Indeterminate (HWND hwnd, WPARAM wParam, LPARAM lParam)
 	btnPtr->fsState |= TBSTATE_INDETERMINATE;
 
     if(oldState != btnPtr->fsState)
-        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
 
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_InsertButtonT(HWND hwnd, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
+TOOLBAR_InsertButtonT(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPTBBUTTON lpTbb = (LPTBBUTTON)lParam;
     INT nIndex = (INT)wParam;
 
@@ -3801,9 +3744,8 @@ TOOLBAR_InsertButtonT(HWND hwnd, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
 

 static LRESULT
-TOOLBAR_IsButtonChecked (HWND hwnd, WPARAM wParam)
+TOOLBAR_IsButtonChecked (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
@@ -3815,9 +3757,8 @@ TOOLBAR_IsButtonChecked (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_IsButtonEnabled (HWND hwnd, WPARAM wParam)
+TOOLBAR_IsButtonEnabled (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
@@ -3829,9 +3770,8 @@ TOOLBAR_IsButtonEnabled (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_IsButtonHidden (HWND hwnd, WPARAM wParam)
+TOOLBAR_IsButtonHidden (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
@@ -3843,9 +3783,8 @@ TOOLBAR_IsButtonHidden (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_IsButtonHighlighted (HWND hwnd, WPARAM wParam)
+TOOLBAR_IsButtonHighlighted (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
@@ -3857,9 +3796,8 @@ TOOLBAR_IsButtonHighlighted (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_IsButtonIndeterminate (HWND hwnd, WPARAM wParam)
+TOOLBAR_IsButtonIndeterminate (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
@@ -3871,9 +3809,8 @@ TOOLBAR_IsButtonIndeterminate (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_IsButtonPressed (HWND hwnd, WPARAM wParam)
+TOOLBAR_IsButtonPressed (const TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
@@ -3885,29 +3822,28 @@ TOOLBAR_IsButtonPressed (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_LoadImages (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_LoadImages (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     TBADDBITMAP tbab;
     tbab.hInst = (HINSTANCE)lParam;
     tbab.nID = wParam;
 
-    TRACE("hwnd = %p, hInst = %p, nID = %lu\n", hwnd, tbab.hInst, tbab.nID);
+    TRACE("hwnd = %p, hInst = %p, nID = %lu\n", infoPtr->hwndSelf, tbab.hInst, tbab.nID);
 
-    return TOOLBAR_AddBitmap(hwnd, 0, (LPARAM)&tbab);
+    return TOOLBAR_AddBitmap(infoPtr, 0, (LPARAM)&tbab);
 }
 

 static LRESULT
-TOOLBAR_MapAccelerator (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_MapAccelerator (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     WCHAR wAccel = (WCHAR)wParam;
     UINT* pIDButton = (UINT*)lParam;
     WCHAR wszAccel[] = {'&',wAccel,0};
     int i;
     
     TRACE("hwnd = %p, wAccel = %x(%s), pIDButton = %p\n",
-        hwnd, wAccel, debugstr_wn(&wAccel,1), pIDButton);
+        infoPtr->hwndSelf, wAccel, debugstr_wn(&wAccel,1), pIDButton);
     
     for (i = 0; i < infoPtr->nNumButtons; i++)
     {
@@ -3942,14 +3878,13 @@ TOOLBAR_MapAccelerator (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_MarkButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_MarkButton (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
     DWORD oldState;
     TBUTTON_INFO *btnPtr;
 
-    TRACE("hwnd = %p, wParam = %ld, lParam = 0x%08lx\n", hwnd, wParam, lParam);
+    TRACE("hwnd = %p, wParam = %ld, lParam = 0x%08lx\n", infoPtr->hwndSelf, wParam, lParam);
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
     if (nIndex == -1)
@@ -3964,7 +3899,7 @@ TOOLBAR_MarkButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
         btnPtr->fsState &= ~TBSTATE_MARKED;
 
     if(oldState != btnPtr->fsState)
-        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
 
     return TRUE;
 }
@@ -3991,15 +3926,14 @@ static inline void TOOLBAR_MoveFixupIndex(INT* pIndex, INT nIndex, INT nMoveInde
 

 static LRESULT
-TOOLBAR_MoveButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_MoveButton (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex;
     INT nCount;
     INT nMoveIndex = (INT)lParam;
     TBUTTON_INFO button;
 
-    TRACE("hwnd=%p, wParam=%ld, lParam=%ld\n", hwnd, wParam, lParam);
+    TRACE("hwnd=%p, wParam=%ld, lParam=%ld\n", infoPtr->hwndSelf, wParam, lParam);
 
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, TRUE);
     if ((nIndex == -1) || (nMoveIndex < 0))
@@ -4034,18 +3968,17 @@ TOOLBAR_MoveButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
         TOOLBAR_MoveFixupIndex(&infoPtr->nHotItem, nIndex, nMoveIndex, FALSE);
     }
 
-    TOOLBAR_LayoutToolbar(hwnd);
-    TOOLBAR_AutoSize(hwnd);
-    InvalidateRect(hwnd, NULL, TRUE);
+    TOOLBAR_LayoutToolbar(infoPtr);
+    TOOLBAR_AutoSize(infoPtr);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
 
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_PressButton (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT nIndex;
     DWORD oldState;
@@ -4062,7 +3995,7 @@ TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 	btnPtr->fsState |= TBSTATE_PRESSED;
 
     if(oldState != btnPtr->fsState)
-        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
 
     return TRUE;
 }
@@ -4070,9 +4003,8 @@ TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 /* FIXME: there might still be some confusion her between number of buttons
  * and number of bitmaps */
 static LRESULT
-TOOLBAR_ReplaceBitmap (HWND hwnd, LPARAM lParam)
+TOOLBAR_ReplaceBitmap (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPTBREPLACEBITMAP lpReplace = (LPTBREPLACEBITMAP) lParam;
     HBITMAP hBitmap;
     int i = 0, nOldButtons = 0, pos = 0;
@@ -4142,7 +4074,7 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, LPARAM lParam)
     TRACE(" pos %d  %d old bitmaps replaced by %d new ones.\n",
             pos, nOldBitmaps, nNewBitmaps);
 
-    InvalidateRect(hwnd, NULL, TRUE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return TRUE;
 }
 
@@ -4253,8 +4185,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
                 if (HIWORD(nmtbr.tbButton.iString))
                     nmtbr.tbButton.iString = 0;
 
-                TOOLBAR_InsertButtonT(infoPtr->hwndSelf, -1,
-                    (LPARAM)&nmtbr.tbButton, TRUE);
+                TOOLBAR_InsertButtonT(infoPtr, -1, (LPARAM)&nmtbr.tbButton, TRUE);
             }
 
             /* do legacy notifications */
@@ -4270,7 +4201,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
              * delete */
             for (i = infoPtr->nNumButtons - 1; i >= 0; i--)
                 if (infoPtr->buttons[i].iBitmap == -1)
-                    TOOLBAR_DeleteButton(infoPtr->hwndSelf, i);
+                    TOOLBAR_DeleteButton(infoPtr, i);
 
             /* only indicate success if at least one button survived */
             if (infoPtr->nNumButtons > 0) ret = TRUE;
@@ -4284,10 +4215,8 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
 

 static LRESULT
-TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, const TBSAVEPARAMSW *lpSave)
+TOOLBAR_SaveRestoreW (TOOLBAR_INFO *infoPtr, WPARAM wParam, const TBSAVEPARAMSW *lpSave)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     if (lpSave == NULL) return 0;
 
     if (wParam)
@@ -4298,7 +4227,7 @@ TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, const TBSAVEPARAMSW *lpSave)
 

 static LRESULT
-TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, const TBSAVEPARAMSA *lpSave)
+TOOLBAR_SaveRestoreA (TOOLBAR_INFO *infoPtr, WPARAM wParam, const TBSAVEPARAMSA *lpSave)
 {
     LPWSTR pszValueName = 0, pszSubKey = 0;
     TBSAVEPARAMSW SaveW;
@@ -4320,7 +4249,7 @@ TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, const TBSAVEPARAMSA *lpSave)
     SaveW.pszValueName = pszValueName;
     SaveW.pszSubKey = pszSubKey;
     SaveW.hkr = lpSave->hkr;
-    result = TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW);
+    result = TOOLBAR_SaveRestoreW(infoPtr, wParam, &SaveW);
 
 exit:
     Free (pszValueName);
@@ -4331,12 +4260,11 @@ exit:
 

 static LRESULT
-TOOLBAR_SetAnchorHighlight (HWND hwnd, WPARAM wParam)
+TOOLBAR_SetAnchorHighlight (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     BOOL bOldAnchor = infoPtr->bAnchor;
 
-    TRACE("hwnd=%p, bAnchor = %s\n", hwnd, wParam ? "TRUE" : "FALSE");
+    TRACE("hwnd=%p, bAnchor = %s\n", infoPtr->hwndSelf, wParam ? "TRUE" : "FALSE");
 
     infoPtr->bAnchor = (BOOL)wParam;
 
@@ -4347,14 +4275,13 @@ TOOLBAR_SetAnchorHighlight (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetBitmapSize (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     HIMAGELIST himlDef = GETDEFIMAGELIST(infoPtr, 0);
     short width = (short)LOWORD(lParam);
     short height = (short)HIWORD(lParam);
 
-    TRACE("hwnd=%p, wParam=%ld, lParam=%ld\n", hwnd, wParam, lParam);
+    TRACE("hwnd=%p, wParam=%ld, lParam=%ld\n", infoPtr->hwndSelf, wParam, lParam);
 
     if (wParam != 0)
         FIXME("wParam is %ld. Perhaps image list index?\n", wParam);
@@ -4391,16 +4318,15 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
             infoPtr->nBitmapHeight);
     }
 
-    TOOLBAR_CalcToolbar(hwnd);
+    TOOLBAR_CalcToolbar(infoPtr);
     InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_SetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetButtonInfoA (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPTBBUTTONINFOA lptbbi = (LPTBBUTTONINFOA)lParam;
     TBUTTON_INFO *btnPtr;
     INT nIndex;
@@ -4440,21 +4366,20 @@ TOOLBAR_SetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     /* save the button rect to see if we need to redraw the whole toolbar */
     oldBtnRect = btnPtr->rect;
-    TOOLBAR_LayoutToolbar(hwnd);
+    TOOLBAR_LayoutToolbar(infoPtr);
 
     if (!EqualRect(&oldBtnRect, &btnPtr->rect))
-        InvalidateRect(hwnd, NULL, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     else
-        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
 
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_SetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetButtonInfoW (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPTBBUTTONINFOW lptbbi = (LPTBBUTTONINFOW)lParam;
     TBUTTON_INFO *btnPtr;
     INT nIndex;
@@ -4493,21 +4418,20 @@ TOOLBAR_SetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     /* save the button rect to see if we need to redraw the whole toolbar */
     oldBtnRect = btnPtr->rect;
-    TOOLBAR_LayoutToolbar(hwnd);
+    TOOLBAR_LayoutToolbar(infoPtr);
 
     if (!EqualRect(&oldBtnRect, &btnPtr->rect))
-        InvalidateRect(hwnd, NULL, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     else
-        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
 
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_SetButtonSize (HWND hwnd, LPARAM lParam)
+TOOLBAR_SetButtonSize (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT cx = (short)LOWORD(lParam), cy = (short)HIWORD(lParam);
 
     if ((cx < 0) || (cy < 0))
@@ -4516,7 +4440,7 @@ TOOLBAR_SetButtonSize (HWND hwnd, LPARAM lParam)
         return FALSE;
     }
 
-    TRACE("%p, cx = %d, cy = %d\n", hwnd, cx, cy);
+    TRACE("%p, cx = %d, cy = %d\n", infoPtr->hwndSelf, cx, cy);
 
     /* The documentation claims you can only change the button size before
      * any button has been added. But this is wrong.
@@ -4539,16 +4463,14 @@ TOOLBAR_SetButtonSize (HWND hwnd, LPARAM lParam)
     infoPtr->nButtonHeight = cy;
     
     infoPtr->iTopMargin = default_top_margin(infoPtr);
-    TOOLBAR_LayoutToolbar(hwnd);
+    TOOLBAR_LayoutToolbar(infoPtr);
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_SetButtonWidth (HWND hwnd, LPARAM lParam)
+TOOLBAR_SetButtonWidth (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     /* if setting to current values, ignore */
     if ((infoPtr->cxMin == (short)LOWORD(lParam)) &&
 	(infoPtr->cxMax == (short)HIWORD(lParam))) {
@@ -4567,18 +4489,17 @@ TOOLBAR_SetButtonWidth (HWND hwnd, LPARAM lParam)
     TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n",
 	infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax);
 
-    TOOLBAR_CalcToolbar (hwnd);
+    TOOLBAR_CalcToolbar (infoPtr);
 
-    InvalidateRect (hwnd, NULL, TRUE);
+    InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
 
     return TRUE;
 }
 

 static LRESULT
-TOOLBAR_SetCmdId (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetCmdId (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nIndex = (INT)wParam;
 
     if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
@@ -4597,9 +4518,8 @@ TOOLBAR_SetCmdId (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_SetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetDisabledImageList (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     HIMAGELIST himl = (HIMAGELIST)lParam;
     HIMAGELIST himlTemp;
     INT id = 0;
@@ -4617,12 +4537,11 @@ TOOLBAR_SetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_SetDrawTextFlags (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetDrawTextFlags (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     DWORD dwTemp;
 
-    TRACE("hwnd = %p, dwMask = 0x%08x, dwDTFlags = 0x%08x\n", hwnd, (DWORD)wParam, (DWORD)lParam);
+    TRACE("hwnd = %p, dwMask = 0x%08x, dwDTFlags = 0x%08x\n", infoPtr->hwndSelf, (DWORD)wParam, (DWORD)lParam);
 
     dwTemp = infoPtr->dwDTFlags;
     infoPtr->dwDTFlags =
@@ -4638,9 +4557,8 @@ TOOLBAR_SetDrawTextFlags (HWND hwnd, WPARAM wParam, LPARAM lParam)
  *  (MSDN says that this parameter is reserved)
  */
 static LRESULT
-TOOLBAR_SetExtendedStyle (HWND hwnd, LPARAM lParam)
+TOOLBAR_SetExtendedStyle (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     DWORD dwOldStyle;
 
     dwOldStyle = infoPtr->dwExStyle;
@@ -4653,21 +4571,20 @@ TOOLBAR_SetExtendedStyle (HWND hwnd, LPARAM lParam)
 	      (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL));
 
     if ((dwOldStyle ^ infoPtr->dwExStyle) & TBSTYLE_EX_MIXEDBUTTONS)
-        TOOLBAR_CalcToolbar(hwnd);
+        TOOLBAR_CalcToolbar(infoPtr);
     else
-        TOOLBAR_LayoutToolbar(hwnd);
+        TOOLBAR_LayoutToolbar(infoPtr);
 
-    TOOLBAR_AutoSize(hwnd);
-    InvalidateRect(hwnd, NULL, TRUE);
+    TOOLBAR_AutoSize(infoPtr);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
 
     return (LRESULT)dwOldStyle;
 }
 

 static LRESULT
-TOOLBAR_SetHotImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetHotImageList (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     HIMAGELIST himlTemp;
     HIMAGELIST himl = (HIMAGELIST)lParam;
     INT id = 0;
@@ -4675,7 +4592,7 @@ TOOLBAR_SetHotImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
     if (infoPtr->iVersion >= 5)
         id = wParam;
 
-    TRACE("hwnd = %p, himl = %p, id = %d\n", hwnd, himl, id);
+    TRACE("hwnd = %p, himl = %p, id = %d\n", infoPtr->hwndSelf, himl, id);
 
     himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlHot, 
         &infoPtr->cimlHot, himl, id);
@@ -4744,12 +4661,11 @@ TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason)
 }
 
 static LRESULT
-TOOLBAR_SetHotItem (HWND hwnd, WPARAM wParam)
+TOOLBAR_SetHotItem (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     INT nOldHotItem = infoPtr->nHotItem;
 
-    TRACE("hwnd = %p, nHit = %d\n", hwnd, (INT)wParam);
+    TRACE("hwnd = %p, nHit = %d\n", infoPtr->hwndSelf, (INT)wParam);
 
     if ((INT)wParam >= infoPtr->nNumButtons)
         return infoPtr->nHotItem;
@@ -4770,9 +4686,8 @@ TOOLBAR_SetHotItem (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetImageList (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     HIMAGELIST himlTemp;
     HIMAGELIST himl = (HIMAGELIST)lParam;
     INT oldButtonWidth = infoPtr->nButtonWidth;
@@ -4798,26 +4713,24 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
     }
     if ((oldBitmapWidth != infoPtr->nBitmapWidth) || (oldBitmapHeight != infoPtr->nBitmapHeight))
     {
-        TOOLBAR_CalcToolbar(hwnd);
+        TOOLBAR_CalcToolbar(infoPtr);
         if (infoPtr->nButtonWidth < oldButtonWidth)
-            TOOLBAR_SetButtonSize(hwnd, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight));
+            TOOLBAR_SetButtonSize(infoPtr, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight));
     }
 
     TRACE("hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d\n",
-	  hwnd, infoPtr->himlDef, id, infoPtr->nNumBitmaps,
+	  infoPtr->hwndSelf, infoPtr->himlDef, id, infoPtr->nNumBitmaps,
 	  infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
 
-    InvalidateRect(hwnd, NULL, TRUE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
 
     return (LRESULT)himlTemp;
 }
 

 static LRESULT
-TOOLBAR_SetIndent (HWND hwnd, WPARAM wParam)
+TOOLBAR_SetIndent (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     infoPtr->nIndent = (INT)wParam;
 
     TRACE("\n");
@@ -4826,8 +4739,8 @@ TOOLBAR_SetIndent (HWND hwnd, WPARAM wParam)
     if(infoPtr->nIndent != (INT)wParam)
     {
         infoPtr->nIndent = (INT)wParam;
-        TOOLBAR_CalcToolbar (hwnd);
-        InvalidateRect(hwnd, NULL, FALSE);
+        TOOLBAR_CalcToolbar (infoPtr);
+        InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     }
 
     return TRUE;
@@ -4835,12 +4748,11 @@ TOOLBAR_SetIndent (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_SetInsertMark (HWND hwnd, LPARAM lParam)
+TOOLBAR_SetInsertMark (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBINSERTMARK *lptbim = (TBINSERTMARK*)lParam;
 
-    TRACE("hwnd = %p, lptbim = { %d, 0x%08x}\n", hwnd, lptbim->iButton, lptbim->dwFlags);
+    TRACE("hwnd = %p, lptbim = { %d, 0x%08x}\n", infoPtr->hwndSelf, lptbim->iButton, lptbim->dwFlags);
 
     if ((lptbim->dwFlags & ~TBIMHT_AFTER) != 0)
     {
@@ -4854,7 +4766,7 @@ TOOLBAR_SetInsertMark (HWND hwnd, LPARAM lParam)
     {
         infoPtr->tbim = *lptbim;
         /* FIXME: don't need to update entire toolbar */
-        InvalidateRect(hwnd, NULL, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     }
     else
         ERR("Invalid button index %d\n", lptbim->iButton);
@@ -4864,27 +4776,23 @@ TOOLBAR_SetInsertMark (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_SetInsertMarkColor (HWND hwnd, LPARAM lParam)
+TOOLBAR_SetInsertMarkColor (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     infoPtr->clrInsertMark = (COLORREF)lParam;
 
     /* FIXME: don't need to update entire toolbar */
-    InvalidateRect(hwnd, NULL, TRUE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
 
     return 0;
 }
 

 static LRESULT
-TOOLBAR_SetMaxTextRows (HWND hwnd, WPARAM wParam)
+TOOLBAR_SetMaxTextRows (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     infoPtr->nMaxTextRows = (INT)wParam;
 
-    TOOLBAR_CalcToolbar(hwnd);
+    TOOLBAR_CalcToolbar(infoPtr);
     return TRUE;
 }
 
@@ -4901,9 +4809,8 @@ TOOLBAR_SetMaxTextRows (HWND hwnd, WPARAM wParam)
  * See blueprints in comments above TOOLBAR_MeasureButton for more info.
  */
 static LRESULT
-TOOLBAR_SetPadding (HWND hwnd, LPARAM lParam)
+TOOLBAR_SetPadding (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     DWORD  oldPad;
 
     oldPad = MAKELONG(infoPtr->szPadding.cx, infoPtr->szPadding.cy);
@@ -4916,9 +4823,8 @@ TOOLBAR_SetPadding (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_SetParent (HWND hwnd, WPARAM wParam)
+TOOLBAR_SetParent (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     HWND hwndOldNotify;
 
     TRACE("\n");
@@ -4931,9 +4837,8 @@ TOOLBAR_SetParent (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_SetRows (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetRows (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPRECT lprc = (LPRECT)lParam;
     int rows = LOWORD(wParam);
     BOOL bLarger = HIWORD(wParam);
@@ -5024,20 +4929,20 @@ TOOLBAR_SetRows (HWND hwnd, WPARAM wParam, LPARAM lParam)
         TRACE("Result - %d rows\n", curRow + 1);
 
         /* recalculate toolbar */
-        TOOLBAR_CalcToolbar (hwnd);
+        TOOLBAR_CalcToolbar (infoPtr);
 
         /* Resize if necessary (Only if NORESIZE is set - odd, but basically
            if NORESIZE is NOT set, then the toolbar will always be resized to
            take up the whole window. With it set, sizing needs to be manual. */
         if (infoPtr->dwStyle & CCS_NORESIZE) {
-            SetWindowPos(hwnd, NULL, 0, 0,
+            SetWindowPos(infoPtr->hwndSelf, NULL, 0, 0,
                          infoPtr->rcBound.right - infoPtr->rcBound.left,
                          infoPtr->rcBound.bottom - infoPtr->rcBound.top,
                          SWP_NOMOVE);
         }
 
         /* repaint toolbar */
-        InvalidateRect(hwnd, NULL, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     }
 
     /* return bounding rectangle */
@@ -5053,9 +4958,8 @@ TOOLBAR_SetRows (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetState (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     INT nIndex;
 
@@ -5068,8 +4972,8 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam)
     /* if hidden state has changed the invalidate entire window and recalc */
     if ((btnPtr->fsState & TBSTATE_HIDDEN) != (LOWORD(lParam) & TBSTATE_HIDDEN)) {
 	btnPtr->fsState = LOWORD(lParam);
-	TOOLBAR_CalcToolbar (hwnd);
-	InvalidateRect(hwnd, 0, TRUE);
+	TOOLBAR_CalcToolbar (infoPtr);
+	InvalidateRect(infoPtr->hwndSelf, 0, TRUE);
 	return TRUE;
     }
 
@@ -5077,7 +4981,7 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam)
     if(btnPtr->fsState != LOWORD(lParam))
     {
         btnPtr->fsState = LOWORD(lParam);
-        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
     }
 
     return TRUE;
@@ -5085,20 +4989,18 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_SetStyle (HWND hwnd, LPARAM lParam)
+TOOLBAR_SetStyle (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    SetWindowLongW(hwnd, GWL_STYLE, lParam);
+    SetWindowLongW(infoPtr->hwndSelf, GWL_STYLE, lParam);
 
     return TRUE;
 }
 

 static inline LRESULT
-TOOLBAR_SetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetToolTips (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
-    TRACE("hwnd=%p, hwndTooltip=%p, lParam=0x%lx\n", hwnd, (HWND)wParam, lParam);
+    TRACE("hwnd=%p, hwndTooltip=%p, lParam=0x%lx\n", infoPtr->hwndSelf, (HWND)wParam, lParam);
 
     infoPtr->hwndToolTip = (HWND)wParam;
     return 0;
@@ -5106,13 +5008,12 @@ TOOLBAR_SetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam)
+TOOLBAR_SetUnicodeFormat (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     BOOL bTemp;
 
     TRACE("%s hwnd=%p\n",
-	   ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd);
+	   ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf);
 
     bTemp = infoPtr->bUnicode;
     infoPtr->bUnicode = (BOOL)wParam;
@@ -5122,10 +5023,8 @@ TOOLBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_GetColorScheme (HWND hwnd, LPCOLORSCHEME lParam)
+TOOLBAR_GetColorScheme (const TOOLBAR_INFO *infoPtr, LPCOLORSCHEME lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
 	                       comctl32_color.clrBtnHighlight :
                                infoPtr->clrBtnHighlight;
@@ -5136,46 +5035,42 @@ TOOLBAR_GetColorScheme (HWND hwnd, LPCOLORSCHEME lParam)
 

 static LRESULT
-TOOLBAR_SetColorScheme (HWND hwnd, const COLORSCHEME *lParam)
+TOOLBAR_SetColorScheme (TOOLBAR_INFO *infoPtr, const COLORSCHEME *lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     TRACE("new colors Hl=%x Shd=%x, old colors Hl=%x Shd=%x\n",
 	  lParam->clrBtnHighlight, lParam->clrBtnShadow,
 	  infoPtr->clrBtnHighlight, infoPtr->clrBtnShadow);
 
     infoPtr->clrBtnHighlight = lParam->clrBtnHighlight;
     infoPtr->clrBtnShadow = lParam->clrBtnShadow;
-    InvalidateRect(hwnd, NULL, TRUE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return 0;
 }
 

 static LRESULT
-TOOLBAR_SetVersion (HWND hwnd, INT iVersion)
+TOOLBAR_SetVersion (TOOLBAR_INFO *infoPtr, INT iVersion)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT iOldVersion = infoPtr->iVersion;
 
     infoPtr->iVersion = iVersion;
 
     if (infoPtr->iVersion >= 5)
-        TOOLBAR_SetUnicodeFormat(hwnd, TRUE);
+        TOOLBAR_SetUnicodeFormat(infoPtr, TRUE);
 
     return iOldVersion;
 }
 

 static LRESULT
-TOOLBAR_GetStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetStringA (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     WORD iString = HIWORD(wParam);
     WORD buffersize = LOWORD(wParam);
     LPSTR str = (LPSTR)lParam;
     LRESULT ret = -1;
 
-    TRACE("hwnd=%p, iString=%d, buffersize=%d, string=%p\n", hwnd, iString, buffersize, str);
+    TRACE("hwnd=%p, iString=%d, buffersize=%d, string=%p\n", infoPtr->hwndSelf, iString, buffersize, str);
 
     if (iString < infoPtr->nNumStrings)
     {
@@ -5192,15 +5087,14 @@ TOOLBAR_GetStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetStringW (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     WORD iString = HIWORD(wParam);
     WORD len = LOWORD(wParam)/sizeof(WCHAR) - 1;
     LPWSTR str = (LPWSTR)lParam;
     LRESULT ret = -1;
 
-    TRACE("hwnd=%p, iString=%d, buffersize=%d, string=%p\n", hwnd, iString, LOWORD(wParam), str);
+    TRACE("hwnd=%p, iString=%d, buffersize=%d, string=%p\n", infoPtr->hwndSelf, iString, LOWORD(wParam), str);
 
     if (iString < infoPtr->nNumStrings)
     {
@@ -5235,9 +5129,8 @@ static LRESULT TOOLBAR_Unkwn45D(HWND hwnd, WPARAM wParam, LPARAM lParam)
  * caller to specify a reason why the hot item changed (rather than just the
  * HICF_OTHER that TB_SETHOTITEM sends). */
 static LRESULT
-TOOLBAR_SetHotItem2 (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetHotItem2 (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     INT nOldHotItem = infoPtr->nHotItem;
 
     TRACE("old item=%d, new item=%d, flags=%08x\n",
@@ -5259,34 +5152,29 @@ TOOLBAR_SetHotItem2 (HWND hwnd, WPARAM wParam, LPARAM lParam)
 /* Sets the toolbar global iListGap parameter which controls the amount of
  * spacing between the image and the text of buttons for TBSTYLE_LIST
  * toolbars. */
-static LRESULT TOOLBAR_SetListGap(HWND hwnd, WPARAM wParam)
+static LRESULT TOOLBAR_SetListGap(TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
-
-    TRACE("hwnd=%p iListGap=%ld\n", hwnd, wParam);
+    TRACE("hwnd=%p iListGap=%ld\n", infoPtr->hwndSelf, wParam);
     
     infoPtr->iListGap = (INT)wParam;
 
-    InvalidateRect(hwnd, NULL, TRUE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
 
     return 0;
 }
 
 /* Returns the number of maximum number of image lists associated with the
  * various states. */
-static LRESULT TOOLBAR_GetImageListCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT TOOLBAR_GetImageListCount(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
-
-    TRACE("hwnd=%p wParam %08lx lParam %08lx\n", hwnd, wParam, lParam);
+    TRACE("hwnd=%p wParam %08lx lParam %08lx\n", infoPtr->hwndSelf, wParam, lParam);
 
     return max(infoPtr->cimlDef, max(infoPtr->cimlHot, infoPtr->cimlDis));
 }
 
 static LRESULT
-TOOLBAR_GetIdealSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_GetIdealSize (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPSIZE lpsize = (LPSIZE)lParam;
 
     if (lpsize == NULL)
@@ -5310,9 +5198,9 @@ TOOLBAR_GetIdealSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
 	}
 	else if(HIWORD(lpsize->cx)) {
 	    RECT rc;
-	    HWND hwndParent = GetParent(hwnd);
+	    HWND hwndParent = GetParent(infoPtr->hwndSelf);
 
-	    GetWindowRect(hwnd, &rc);
+	    GetWindowRect(infoPtr->hwndSelf, &rc);
 	    MapWindowPoints(0, hwndParent, (LPPOINT)&rc, 2);
             TRACE("mapped to (%s)\n", wine_dbgstr_rect(&rc));
 	    lpsize->cx = max(rc.right-rc.left,
@@ -5346,7 +5234,7 @@ static LRESULT TOOLBAR_Unkwn464(HWND hwnd, WPARAM wParam, LPARAM lParam)
 static LRESULT
 TOOLBAR_Create (HWND hwnd, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
+    TOOLBAR_INFO *infoPtr = (TOOLBAR_INFO *)GetWindowLongPtrW(hwnd, 0);
     DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
     LOGFONTW logFont;
 
@@ -5394,17 +5282,15 @@ TOOLBAR_Create (HWND hwnd, LPARAM lParam)
     
     OpenThemeData (hwnd, themeClass);
 
-    TOOLBAR_CheckStyle (hwnd, dwStyle);
+    TOOLBAR_CheckStyle (infoPtr, dwStyle);
 
     return 0;
 }
 

 static LRESULT
-TOOLBAR_Destroy (HWND hwnd)
+TOOLBAR_Destroy (TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     /* delete tooltip control */
     if (infoPtr->hwndToolTip)
 	DestroyWindow (infoPtr->hwndToolTip);
@@ -5436,24 +5322,23 @@ TOOLBAR_Destroy (HWND hwnd)
     /* delete default font */
     DeleteObject (infoPtr->hDefaultFont);
         
-    CloseThemeData (GetWindowTheme (hwnd));
+    CloseThemeData (GetWindowTheme (infoPtr->hwndSelf));
 
     /* free toolbar info data */
     Free (infoPtr);
-    SetWindowLongPtrW (hwnd, 0, 0);
+    SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
 
     return 0;
 }
 

 static LRESULT
-TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_EraseBackground (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     NMTBCUSTOMDRAW tbcd;
     INT ret = FALSE;
     DWORD ntfret;
-    HTHEME theme = GetWindowTheme (hwnd);
+    HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
     DWORD dwEraseCustDraw = 0;
 
     /* the app has told us not to redraw the toolbar */
@@ -5476,7 +5361,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
 		return TRUE;
 	    default:
 		FIXME("[%p] response %d not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",
-		      hwnd, ntfret);
+		      infoPtr->hwndSelf, ntfret);
 	    }
     }
 
@@ -5490,14 +5375,14 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
 	pt.x = 0;
 	pt.y = 0;
-	parent = GetParent(hwnd);
-	MapWindowPoints(hwnd, parent, &pt, 1);
+	parent = GetParent(infoPtr->hwndSelf);
+	MapWindowPoints(infoPtr->hwndSelf, parent, &pt, 1);
 	OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig);
 	ret = SendMessageW (parent, WM_ERASEBKGND, wParam, lParam);
 	SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0);
     }
     if (!ret)
-	ret = DefWindowProcW (hwnd, WM_ERASEBKGND, wParam, lParam);
+	ret = DefWindowProcW (infoPtr->hwndSelf, WM_ERASEBKGND, wParam, lParam);
 
     if (dwEraseCustDraw & CDRF_NOTIFYPOSTERASE) {
 	ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
@@ -5513,7 +5398,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
 		return TRUE;
 	    default:
 		FIXME("[%p] response %d not handled to NM_CUSTOMDRAW (CDDS_POSTERASE)\n",
-		      hwnd, ntfret);
+		      infoPtr->hwndSelf, ntfret);
 	    }
     }
     return ret;
@@ -5521,10 +5406,8 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_GetFont (HWND hwnd)
+TOOLBAR_GetFont (const TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     return (LRESULT)infoPtr->hFont;
 }
 
@@ -5563,16 +5446,15 @@ TOOLBAR_SetRelativeHotItem(TOOLBAR_INFO *infoPtr, INT iDirection, DWORD dwReason
 }
 
 static LRESULT
-TOOLBAR_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_KeyDown (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     NMKEY nmkey;
 
     nmkey.nVKey = (UINT)wParam;
     nmkey.uFlags = HIWORD(lParam);
 
     if (TOOLBAR_SendNotify(&nmkey.hdr, infoPtr, NM_KEYDOWN))
-        return DefWindowProcW(hwnd, WM_KEYDOWN, wParam, lParam);
+        return DefWindowProcW(infoPtr->hwndSelf, WM_KEYDOWN, wParam, lParam);
 
     switch ((UINT)wParam)
     {
@@ -5591,7 +5473,7 @@ TOOLBAR_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
         {
             SendMessageW (infoPtr->hwndNotify, WM_COMMAND,
                 MAKEWPARAM(infoPtr->buttons[infoPtr->nHotItem].idCommand, BN_CLICKED),
-                (LPARAM)hwnd);
+                (LPARAM)infoPtr->hwndSelf);
         }
         break;
     }
@@ -5601,28 +5483,27 @@ TOOLBAR_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_LButtonDblClk (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     POINT pt;
     INT   nHit;
 
     pt.x = (short)LOWORD(lParam);
     pt.y = (short)HIWORD(lParam);
-    nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
+    nHit = TOOLBAR_InternalHitTest (infoPtr, &pt);
 
     if (nHit >= 0)
-        TOOLBAR_LButtonDown (hwnd, wParam, lParam);
-    else if (GetWindowLongW (hwnd, GWL_STYLE) & CCS_ADJUSTABLE)
-	TOOLBAR_Customize (hwnd);
+        TOOLBAR_LButtonDown (infoPtr, wParam, lParam);
+    else if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & CCS_ADJUSTABLE)
+	TOOLBAR_Customize (infoPtr);
 
     return 0;
 }
 

 static LRESULT
-TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_LButtonDown (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     POINT pt;
     INT   nHit;
@@ -5638,19 +5519,19 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
         bDragKeyPressed = (wParam & MK_SHIFT);
 
     if (infoPtr->hwndToolTip)
-	TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
+	TOOLBAR_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwndSelf,
 			    WM_LBUTTONDOWN, wParam, lParam);
 
     pt.x = (short)LOWORD(lParam);
     pt.y = (short)HIWORD(lParam);
-    nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
+    nHit = TOOLBAR_InternalHitTest (infoPtr, &pt);
 
     btnPtr = &infoPtr->buttons[nHit];
 
     if ((nHit >= 0) && bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE))
     {
         infoPtr->nButtonDrag = nHit;
-        SetCapture (hwnd);
+        SetCapture (infoPtr->hwndSelf);
         
         /* If drag cursor has not been loaded, load it.
          * Note: it doesn't need to be freed */
@@ -5680,7 +5561,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
 	        btnPtr->fsState |= TBSTATE_PRESSED;
 	    else
 	        btnPtr->bDropDownPressed = TRUE;
-	    RedrawWindow(hwnd,&btnPtr->rect,0,
+	    RedrawWindow(infoPtr->hwndSelf,&btnPtr->rect,0,
 			RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
 
 	    memset(&nmtb, 0, sizeof(nmtb));
@@ -5699,20 +5580,20 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
        	            btnPtr->fsState &= ~TBSTATE_PRESSED;
        	        else
        	            btnPtr->bDropDownPressed = FALSE;
-       	        InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+                InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
 
                 /* find and set hot item
                  * NOTE: native doesn't do this, but that is a bug */
                 GetCursorPos(&pt);
-                ScreenToClient(hwnd, &pt);
-                nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
+                ScreenToClient(infoPtr->hwndSelf, &pt);
+                nHit = TOOLBAR_InternalHitTest(infoPtr, &pt);
                 if (!infoPtr->bAnchor || (nHit >= 0))
                     TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
                 
                 /* remove any left mouse button down or double-click messages
                  * so that we can get a toggle effect on the button */
-                while (PeekMessageW(&msg, hwnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) ||
-                       PeekMessageW(&msg, hwnd, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE))
+                while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) ||
+                       PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE))
                     ;
 
 		return 0;
@@ -5728,9 +5609,9 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
         TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
 
         if (btnPtr->fsState & TBSTATE_ENABLED)
-	    InvalidateRect(hwnd, &btnPtr->rect, TRUE);
-	UpdateWindow(hwnd);
-	SetCapture (hwnd);
+	    InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
+	UpdateWindow(infoPtr->hwndSelf);
+	SetCapture (infoPtr->hwndSelf);
     }
 
     if (nHit >=0)
@@ -5751,19 +5632,18 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
         nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
     }
 
-    ClientToScreen(hwnd, &pt); 
+    ClientToScreen(infoPtr->hwndSelf, &pt);
     nmmouse.pt = pt;
 
     if (!TOOLBAR_SendNotify(&nmmouse.hdr, infoPtr, NM_LDOWN))
-        return DefWindowProcW(hwnd, WM_LBUTTONDOWN, wParam, lParam);
+        return DefWindowProcW(infoPtr->hwndSelf, WM_LBUTTONDOWN, wParam, lParam);
 
     return 0;
 }
 
 static LRESULT
-TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_LButtonUp (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
     POINT pt;
     INT   nHit;
@@ -5773,12 +5653,12 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
     NMTOOLBARA nmtb;
 
     if (infoPtr->hwndToolTip)
-	TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
+	TOOLBAR_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwndSelf,
 			    WM_LBUTTONUP, wParam, lParam);
 
     pt.x = (short)LOWORD(lParam);
     pt.y = (short)HIWORD(lParam);
-    nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
+    nHit = TOOLBAR_InternalHitTest (infoPtr, &pt);
 
     if (!infoPtr->bAnchor || (nHit >= 0))
         TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
@@ -5792,7 +5672,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
         /* reset cursor */
         SetCursor(LoadCursorW(NULL, (LPCWSTR)IDC_ARROW));
 
-        GetClientRect(hwnd, &rcClient);
+        GetClientRect(infoPtr->hwndSelf, &rcClient);
         if (PtInRect(&rcClient, pt))
         {
             INT nButton = -1;
@@ -5810,7 +5690,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
                 if (pt.x < (btnPtr->rect.left + (btnPtr->rect.right - btnPtr->rect.left)/2))
                 {
                     if ((nButton > 0) && (infoPtr->buttons[nButton-1].fsStyle & BTNS_SEP))
-                        TOOLBAR_DeleteButton(hwnd, nButton - 1);
+                        TOOLBAR_DeleteButton(infoPtr, nButton - 1);
                 }
                 else /* else insert a separator before the dragged button */
                 {
@@ -5818,7 +5698,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
                     memset(&tbb, 0, sizeof(tbb));
                     tbb.fsStyle = BTNS_SEP;
                     tbb.iString = -1;
-                    TOOLBAR_InsertButtonT(hwnd, nButton, (LPARAM)&tbb, TRUE);
+                    TOOLBAR_InsertButtonT(infoPtr, nButton, (LPARAM)&tbb, TRUE);
                 }
             }
             else
@@ -5826,18 +5706,18 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
                 if (nButton == -1)
                 {
                     if ((infoPtr->nNumButtons > 0) && (pt.x < infoPtr->buttons[0].rect.left))
-                        TOOLBAR_MoveButton(hwnd, infoPtr->nButtonDrag, 0);
+                        TOOLBAR_MoveButton(infoPtr, infoPtr->nButtonDrag, 0);
                     else
-                        TOOLBAR_MoveButton(hwnd, infoPtr->nButtonDrag, infoPtr->nNumButtons);
+                        TOOLBAR_MoveButton(infoPtr, infoPtr->nButtonDrag, infoPtr->nNumButtons);
                 }
                 else
-                    TOOLBAR_MoveButton(hwnd, infoPtr->nButtonDrag, nButton);
+                    TOOLBAR_MoveButton(infoPtr, infoPtr->nButtonDrag, nButton);
             }
         }
         else
         {
             TRACE("button %d dragged out of toolbar\n", infoPtr->nButtonDrag);
-            TOOLBAR_DeleteButton(hwnd, (WPARAM)infoPtr->nButtonDrag);
+            TOOLBAR_DeleteButton(infoPtr, (WPARAM)infoPtr->nButtonDrag);
         }
 
         /* button under cursor changed so need to re-set hot item */
@@ -5868,7 +5748,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
 	}
 
         if (nOldIndex != -1)
-            InvalidateRect(hwnd, &infoPtr->buttons[nOldIndex].rect, TRUE);
+            InvalidateRect(infoPtr->hwndSelf, &infoPtr->buttons[nOldIndex].rect, TRUE);
 
 	/*
 	 * now we can ReleaseCapture, which triggers CAPTURECHANGED msg,
@@ -5894,10 +5774,10 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
 	if (btnPtr->fsState & TBSTATE_ENABLED)
 	{
 	    SendMessageW (infoPtr->hwndNotify, WM_COMMAND,
-	      MAKEWPARAM(infoPtr->buttons[nHit].idCommand, BN_CLICKED), (LPARAM)hwnd);
+	      MAKEWPARAM(infoPtr->buttons[nHit].idCommand, BN_CLICKED), (LPARAM)infoPtr->hwndSelf);
 
             /* In case we have just been destroyed... */
-            if(!IsWindow(hwnd))
+            if(!IsWindow(infoPtr->hwndSelf))
                 return 0;
         }
     }
@@ -5914,19 +5794,18 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
         nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
     }
 
-    ClientToScreen(hwnd, &pt); 
+    ClientToScreen(infoPtr->hwndSelf, &pt);
     nmmouse.pt = pt;
 
     if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_CLICK))
-        return DefWindowProcW(hwnd, WM_LBUTTONUP, wParam, lParam);
+        return DefWindowProcW(infoPtr->hwndSelf, WM_LBUTTONUP, wParam, lParam);
 
     return 0;
 }
 
 static LRESULT
-TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_RButtonUp(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     INT nHit;
     NMMOUSE nmmouse;
     POINT pt;
@@ -5934,7 +5813,7 @@ TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam)
     pt.x = (short)LOWORD(lParam);
     pt.y = (short)HIWORD(lParam);
 
-    nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
+    nHit = TOOLBAR_InternalHitTest(infoPtr, &pt);
     nmmouse.dwHitInfo = nHit;
 
     if (nHit < 0) {
@@ -5944,31 +5823,29 @@ TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam)
 	nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
     }
 
-    ClientToScreen(hwnd, &pt); 
+    ClientToScreen(infoPtr->hwndSelf, &pt);
     nmmouse.pt = pt;
 
     if (!TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RCLICK))
-        return DefWindowProcW(hwnd, WM_RBUTTONUP, wParam, lParam);
+        return DefWindowProcW(infoPtr->hwndSelf, WM_RBUTTONUP, wParam, lParam);
 
     return 0;
 }
 
 static LRESULT
-TOOLBAR_RButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_RButtonDblClk( TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     NMHDR nmhdr;
 
     if (!TOOLBAR_SendNotify(&nmhdr, infoPtr, NM_RDBLCLK))
-        return DefWindowProcW(hwnd, WM_RBUTTONDBLCLK, wParam, lParam);
+        return DefWindowProcW(infoPtr->hwndSelf, WM_RBUTTONDBLCLK, wParam, lParam);
 
     return 0;
 }
 
 static LRESULT
-TOOLBAR_CaptureChanged(HWND hwnd)
+TOOLBAR_CaptureChanged(TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     TBUTTON_INFO *btnPtr;
 
     infoPtr->bCaptured = FALSE;
@@ -5981,16 +5858,14 @@ TOOLBAR_CaptureChanged(HWND hwnd)
         infoPtr->nOldHit = -1;
 
         if (btnPtr->fsState & TBSTATE_ENABLED)
-            InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+            InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
     }
     return 0;
 }
 
 static LRESULT
-TOOLBAR_MouseLeave (HWND hwnd)
+TOOLBAR_MouseLeave (TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     /* don't remove hot effects when in anchor highlighting mode or when a
      * drop-down button is pressed */
     if (infoPtr->nHotItem >= 0 && !infoPtr->bAnchor)
@@ -6016,7 +5891,7 @@ TOOLBAR_MouseLeave (HWND hwnd)
 
       rc1 = btnPtr->rect;
       InflateRect (&rc1, 1, 1);
-      InvalidateRect (hwnd, &rc1, TRUE);
+      InvalidateRect (infoPtr->hwndSelf, &rc1, TRUE);
     }
 
     if (infoPtr->bCaptured && !infoPtr->bDragOutSent)
@@ -6034,9 +5909,8 @@ TOOLBAR_MouseLeave (HWND hwnd)
 }
 
 static LRESULT
-TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_MouseMove (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     POINT pt;
     TRACKMOUSEEVENT trackinfo;
     INT   nHit;
@@ -6054,9 +5928,9 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
         _TrackMouseEvent(&trackinfo);
 
         /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
-        if(trackinfo.hwndTrack != hwnd || !(trackinfo.dwFlags & TME_LEAVE)) {
+        if(trackinfo.hwndTrack != infoPtr->hwndSelf || !(trackinfo.dwFlags & TME_LEAVE)) {
             trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
-            trackinfo.hwndTrack = hwnd;
+            trackinfo.hwndTrack = infoPtr->hwndSelf;
 
             /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
             /* and can properly deactivate the hot toolbar button */
@@ -6065,13 +5939,13 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
     }
 
     if (infoPtr->hwndToolTip)
-	TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
+	TOOLBAR_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwndSelf,
 			    WM_MOUSEMOVE, wParam, lParam);
 
     pt.x = (short)LOWORD(lParam);
     pt.y = (short)HIWORD(lParam);
 
-    nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
+    nHit = TOOLBAR_InternalHitTest (infoPtr, &pt);
 
     if (((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)) 
         && (!infoPtr->bAnchor || (nHit >= 0)))
@@ -6093,11 +5967,11 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
             btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
             if (infoPtr->nOldHit == infoPtr->nButtonDown) {
                 btnPtr->fsState &= ~TBSTATE_PRESSED;
-                InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+                InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
             }
             else if (nHit == infoPtr->nButtonDown) {
                 btnPtr->fsState |= TBSTATE_PRESSED;
-                InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+                InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
             }
             infoPtr->nOldHit = nHit;
         }
@@ -6366,9 +6240,8 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
 

 static inline LRESULT
-TOOLBAR_Notify (HWND hwnd, LPARAM lParam)
+TOOLBAR_Notify (TOOLBAR_INFO *infoPtr, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     LPNMHDR lpnmh = (LPNMHDR)lParam;
 
     switch (lpnmh->code)
@@ -6439,31 +6312,28 @@ TOOLBAR_NotifyFormat(const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-TOOLBAR_Paint (HWND hwnd, WPARAM wParam)
+TOOLBAR_Paint (TOOLBAR_INFO *infoPtr, WPARAM wParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
     HDC hdc;
     PAINTSTRUCT ps;
 
     /* fill ps.rcPaint with a default rect */
     ps.rcPaint = infoPtr->rcBound;
 
-    hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam;
+    hdc = wParam==0 ? BeginPaint(infoPtr->hwndSelf, &ps) : (HDC)wParam;
 
     TRACE("psrect=(%s)\n", wine_dbgstr_rect(&ps.rcPaint));
 
-    TOOLBAR_Refresh (hwnd, hdc, &ps);
-    if (!wParam) EndPaint (hwnd, &ps);
+    TOOLBAR_Refresh (infoPtr, hdc, &ps);
+    if (!wParam) EndPaint (infoPtr->hwndSelf, &ps);
 
     return 0;
 }
 

 static LRESULT
-TOOLBAR_SetFocus (HWND hwnd)
+TOOLBAR_SetFocus (TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     TRACE("nHotItem = %d\n", infoPtr->nHotItem);
 
     /* make first item hot */
@@ -6474,10 +6344,8 @@ TOOLBAR_SetFocus (HWND hwnd)
 }
 
 static LRESULT
-TOOLBAR_SetFont(HWND hwnd, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetFont(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
-    
     TRACE("font=%p redraw=%ld\n", (HFONT)wParam, lParam);
     
     if (wParam == 0)
@@ -6485,15 +6353,15 @@ TOOLBAR_SetFont(HWND hwnd, WPARAM wParam, LPARAM lParam)
     else
         infoPtr->hFont = (HFONT)wParam;
 
-    TOOLBAR_CalcToolbar(hwnd);
+    TOOLBAR_CalcToolbar(infoPtr);
 
     if (lParam)
-        InvalidateRect(hwnd, NULL, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return 1;
 }
 
 static LRESULT
-TOOLBAR_SetRedraw (HWND hwnd, WPARAM wParam)
+TOOLBAR_SetRedraw (TOOLBAR_INFO *infoPtr, WPARAM wParam)
      /*****************************************************
       *
       * Function;
@@ -6508,7 +6376,6 @@ TOOLBAR_SetRedraw (HWND hwnd, WPARAM wParam)
       *
       *****************************************************/
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
     BOOL oldredraw = infoPtr->bDoRedraw;
 
     TRACE("set to %s\n",
@@ -6522,10 +6389,8 @@ TOOLBAR_SetRedraw (HWND hwnd, WPARAM wParam)
 

 static LRESULT
-TOOLBAR_Size (HWND hwnd)
+TOOLBAR_Size (TOOLBAR_INFO *infoPtr)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     TRACE("sizing toolbar!\n");
 
     if (infoPtr->dwExStyle & TBSTYLE_EX_HIDECLIPPEDBUTTONS)
@@ -6535,7 +6400,7 @@ TOOLBAR_Size (HWND hwnd)
         TBUTTON_INFO *btnPtr;
         INT i;
 
-        GetClientRect(hwnd, &client);
+        GetClientRect(infoPtr->hwndSelf, &client);
         if(client.right > infoPtr->client_rect.right)
         {
             min_x = infoPtr->client_rect.right;
@@ -6565,19 +6430,17 @@ TOOLBAR_Size (HWND hwnd)
         for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
             if(IntersectRect(&dummy, &delta_width, &btnPtr->rect) ||
                 IntersectRect(&dummy, &delta_height, &btnPtr->rect))
-                InvalidateRect(hwnd, &btnPtr->rect, TRUE);
+                InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
     }
-    GetClientRect(hwnd, &infoPtr->client_rect);
-    TOOLBAR_AutoSize(hwnd);
+    GetClientRect(infoPtr->hwndSelf, &infoPtr->client_rect);
+    TOOLBAR_AutoSize(infoPtr);
     return 0;
 }
 

 static LRESULT
-TOOLBAR_StyleChanged (HWND hwnd, INT nType, const STYLESTRUCT *lpStyle)
+TOOLBAR_StyleChanged (TOOLBAR_INFO *infoPtr, INT nType, const STYLESTRUCT *lpStyle)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-
     if (nType == GWL_STYLE)
     {
         DWORD dwOldStyle = infoPtr->dwStyle;
@@ -6587,21 +6450,21 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, const STYLESTRUCT *lpStyle)
         else
             infoPtr->dwDTFlags = DT_CENTER | DT_END_ELLIPSIS;
 
-        TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew);
+        TOOLBAR_CheckStyle (infoPtr, lpStyle->styleNew);
 
         TRACE("new style 0x%08x\n", lpStyle->styleNew);
 
         infoPtr->dwStyle = lpStyle->styleNew;
 
         if ((dwOldStyle ^ lpStyle->styleNew) & (TBSTYLE_WRAPABLE | CCS_VERT))
-            TOOLBAR_LayoutToolbar(hwnd);
+            TOOLBAR_LayoutToolbar(infoPtr);
 
         /* only resize if one of the CCS_* styles was changed */
         if ((dwOldStyle ^ lpStyle->styleNew) & COMMON_STYLES)
         {
-            TOOLBAR_AutoSize (hwnd);
+            TOOLBAR_AutoSize (infoPtr);
     
-            InvalidateRect(hwnd, NULL, TRUE);
+            InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
         }
     }
 
@@ -6631,7 +6494,7 @@ static LRESULT theme_changed (HWND hwnd)
 static LRESULT WINAPI
 ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
+    TOOLBAR_INFO *infoPtr = (TOOLBAR_INFO *)GetWindowLongPtrW(hwnd, 0);
 
     TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n",
 	  hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
@@ -6642,279 +6505,279 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     switch (uMsg)
     {
 	case TB_ADDBITMAP:
-	    return TOOLBAR_AddBitmap (hwnd, wParam, lParam);
+	    return TOOLBAR_AddBitmap (infoPtr, wParam, lParam);
 
 	case TB_ADDBUTTONSA:
-	    return TOOLBAR_AddButtonsT(hwnd, wParam, lParam, FALSE);
+	    return TOOLBAR_AddButtonsT(infoPtr, wParam, lParam, FALSE);
 
 	case TB_ADDBUTTONSW:
-	    return TOOLBAR_AddButtonsT(hwnd, wParam, lParam, TRUE);
+	    return TOOLBAR_AddButtonsT(infoPtr, wParam, lParam, TRUE);
 
 	case TB_ADDSTRINGA:
-	    return TOOLBAR_AddStringA (hwnd, wParam, lParam);
+	    return TOOLBAR_AddStringA (infoPtr, wParam, lParam);
 
 	case TB_ADDSTRINGW:
-	    return TOOLBAR_AddStringW (hwnd, wParam, lParam);
+	    return TOOLBAR_AddStringW (infoPtr, wParam, lParam);
 
 	case TB_AUTOSIZE:
-	    return TOOLBAR_AutoSize (hwnd);
+	    return TOOLBAR_AutoSize (infoPtr);
 
 	case TB_BUTTONCOUNT:
-	    return TOOLBAR_ButtonCount (hwnd);
+	    return TOOLBAR_ButtonCount (infoPtr);
 
 	case TB_BUTTONSTRUCTSIZE:
-	    return TOOLBAR_ButtonStructSize (hwnd, wParam);
+	    return TOOLBAR_ButtonStructSize (infoPtr, wParam);
 
 	case TB_CHANGEBITMAP:
-	    return TOOLBAR_ChangeBitmap (hwnd, wParam, lParam);
+	    return TOOLBAR_ChangeBitmap (infoPtr, wParam, lParam);
 
 	case TB_CHECKBUTTON:
-	    return TOOLBAR_CheckButton (hwnd, wParam, lParam);
+	    return TOOLBAR_CheckButton (infoPtr, wParam, lParam);
 
 	case TB_COMMANDTOINDEX:
-	    return TOOLBAR_CommandToIndex (hwnd, wParam);
+	    return TOOLBAR_CommandToIndex (infoPtr, wParam);
 
 	case TB_CUSTOMIZE:
-	    return TOOLBAR_Customize (hwnd);
+	    return TOOLBAR_Customize (infoPtr);
 
 	case TB_DELETEBUTTON:
-	    return TOOLBAR_DeleteButton (hwnd, wParam);
+	    return TOOLBAR_DeleteButton (infoPtr, wParam);
 
 	case TB_ENABLEBUTTON:
-	    return TOOLBAR_EnableButton (hwnd, wParam, lParam);
+	    return TOOLBAR_EnableButton (infoPtr, wParam, lParam);
 
 	case TB_GETANCHORHIGHLIGHT:
-	    return TOOLBAR_GetAnchorHighlight (hwnd);
+	    return TOOLBAR_GetAnchorHighlight (infoPtr);
 
 	case TB_GETBITMAP:
-	    return TOOLBAR_GetBitmap (hwnd, wParam);
+	    return TOOLBAR_GetBitmap (infoPtr, wParam);
 
 	case TB_GETBITMAPFLAGS:
 	    return TOOLBAR_GetBitmapFlags ();
 
 	case TB_GETBUTTON:
-	    return TOOLBAR_GetButton (hwnd, wParam, lParam);
+	    return TOOLBAR_GetButton (infoPtr, wParam, lParam);
 
 	case TB_GETBUTTONINFOA:
-	    return TOOLBAR_GetButtonInfoT(hwnd, wParam, lParam, FALSE);
+	    return TOOLBAR_GetButtonInfoT(infoPtr, wParam, lParam, FALSE);
 
 	case TB_GETBUTTONINFOW:
-	    return TOOLBAR_GetButtonInfoT(hwnd, wParam, lParam, TRUE);
+	    return TOOLBAR_GetButtonInfoT(infoPtr, wParam, lParam, TRUE);
 
 	case TB_GETBUTTONSIZE:
-	    return TOOLBAR_GetButtonSize (hwnd);
+	    return TOOLBAR_GetButtonSize (infoPtr);
 
 	case TB_GETBUTTONTEXTA:
-	    return TOOLBAR_GetButtonTextA (hwnd, wParam, lParam);
+	    return TOOLBAR_GetButtonTextA (infoPtr, wParam, lParam);
 
 	case TB_GETBUTTONTEXTW:
-	    return TOOLBAR_GetButtonTextW (hwnd, wParam, lParam);
+	    return TOOLBAR_GetButtonTextW (infoPtr, wParam, lParam);
 
 	case TB_GETDISABLEDIMAGELIST:
-	    return TOOLBAR_GetDisabledImageList (hwnd, wParam, lParam);
+	    return TOOLBAR_GetDisabledImageList (infoPtr, wParam, lParam);
 
 	case TB_GETEXTENDEDSTYLE:
-	    return TOOLBAR_GetExtendedStyle (hwnd);
+	    return TOOLBAR_GetExtendedStyle (infoPtr);
 
 	case TB_GETHOTIMAGELIST:
-	    return TOOLBAR_GetHotImageList (hwnd, wParam, lParam);
+	    return TOOLBAR_GetHotImageList (infoPtr, wParam, lParam);
 
 	case TB_GETHOTITEM:
-	    return TOOLBAR_GetHotItem (hwnd);
+	    return TOOLBAR_GetHotItem (infoPtr);
 
 	case TB_GETIMAGELIST:
-	    return TOOLBAR_GetDefImageList (hwnd, wParam, lParam);
+	    return TOOLBAR_GetDefImageList (infoPtr, wParam, lParam);
 
 	case TB_GETINSERTMARK:
-	    return TOOLBAR_GetInsertMark (hwnd, lParam);
+	    return TOOLBAR_GetInsertMark (infoPtr, lParam);
 
 	case TB_GETINSERTMARKCOLOR:
-	    return TOOLBAR_GetInsertMarkColor (hwnd);
+	    return TOOLBAR_GetInsertMarkColor (infoPtr);
 
 	case TB_GETITEMRECT:
-	    return TOOLBAR_GetItemRect (hwnd, wParam, lParam);
+	    return TOOLBAR_GetItemRect (infoPtr, wParam, lParam);
 
 	case TB_GETMAXSIZE:
-	    return TOOLBAR_GetMaxSize (hwnd, lParam);
+	    return TOOLBAR_GetMaxSize (infoPtr, lParam);
 
 /*	case TB_GETOBJECT:			*/ /* 4.71 */
 
 	case TB_GETPADDING:
-	    return TOOLBAR_GetPadding (hwnd);
+	    return TOOLBAR_GetPadding (infoPtr);
 
 	case TB_GETRECT:
-	    return TOOLBAR_GetRect (hwnd, wParam, lParam);
+	    return TOOLBAR_GetRect (infoPtr, wParam, lParam);
 
 	case TB_GETROWS:
-	    return TOOLBAR_GetRows (hwnd);
+	    return TOOLBAR_GetRows (infoPtr);
 
 	case TB_GETSTATE:
-	    return TOOLBAR_GetState (hwnd, wParam);
+	    return TOOLBAR_GetState (infoPtr, wParam);
 
 	case TB_GETSTRINGA:
-        return TOOLBAR_GetStringA (hwnd, wParam, lParam);
+            return TOOLBAR_GetStringA (infoPtr, wParam, lParam);
 
 	case TB_GETSTRINGW:
-	    return TOOLBAR_GetStringW (hwnd, wParam, lParam);
+	    return TOOLBAR_GetStringW (infoPtr, wParam, lParam);
 
 	case TB_GETSTYLE:
-	    return TOOLBAR_GetStyle (hwnd);
+	    return TOOLBAR_GetStyle (infoPtr);
 
 	case TB_GETTEXTROWS:
-	    return TOOLBAR_GetTextRows (hwnd);
+	    return TOOLBAR_GetTextRows (infoPtr);
 
 	case TB_GETTOOLTIPS:
-	    return TOOLBAR_GetToolTips (hwnd);
+	    return TOOLBAR_GetToolTips (infoPtr);
 
 	case TB_GETUNICODEFORMAT:
-	    return TOOLBAR_GetUnicodeFormat (hwnd);
+	    return TOOLBAR_GetUnicodeFormat (infoPtr);
 
 	case TB_HIDEBUTTON:
-	    return TOOLBAR_HideButton (hwnd, wParam, lParam);
+	    return TOOLBAR_HideButton (infoPtr, wParam, lParam);
 
 	case TB_HITTEST:
-	    return TOOLBAR_HitTest (hwnd, lParam);
+	    return TOOLBAR_HitTest (infoPtr, lParam);
 
 	case TB_INDETERMINATE:
-	    return TOOLBAR_Indeterminate (hwnd, wParam, lParam);
+	    return TOOLBAR_Indeterminate (infoPtr, wParam, lParam);
 
 	case TB_INSERTBUTTONA:
-	    return TOOLBAR_InsertButtonT(hwnd, wParam, lParam, FALSE);
+	    return TOOLBAR_InsertButtonT(infoPtr, wParam, lParam, FALSE);
 
 	case TB_INSERTBUTTONW:
-	    return TOOLBAR_InsertButtonT(hwnd, wParam, lParam, TRUE);
+	    return TOOLBAR_InsertButtonT(infoPtr, wParam, lParam, TRUE);
 
 /*	case TB_INSERTMARKHITTEST:		*/ /* 4.71 */
 
 	case TB_ISBUTTONCHECKED:
-	    return TOOLBAR_IsButtonChecked (hwnd, wParam);
+	    return TOOLBAR_IsButtonChecked (infoPtr, wParam);
 
 	case TB_ISBUTTONENABLED:
-	    return TOOLBAR_IsButtonEnabled (hwnd, wParam);
+	    return TOOLBAR_IsButtonEnabled (infoPtr, wParam);
 
 	case TB_ISBUTTONHIDDEN:
-	    return TOOLBAR_IsButtonHidden (hwnd, wParam);
+	    return TOOLBAR_IsButtonHidden (infoPtr, wParam);
 
 	case TB_ISBUTTONHIGHLIGHTED:
-	    return TOOLBAR_IsButtonHighlighted (hwnd, wParam);
+	    return TOOLBAR_IsButtonHighlighted (infoPtr, wParam);
 
 	case TB_ISBUTTONINDETERMINATE:
-	    return TOOLBAR_IsButtonIndeterminate (hwnd, wParam);
+	    return TOOLBAR_IsButtonIndeterminate (infoPtr, wParam);
 
 	case TB_ISBUTTONPRESSED:
-	    return TOOLBAR_IsButtonPressed (hwnd, wParam);
+	    return TOOLBAR_IsButtonPressed (infoPtr, wParam);
 
 	case TB_LOADIMAGES:
-	    return TOOLBAR_LoadImages (hwnd, wParam, lParam);
+	    return TOOLBAR_LoadImages (infoPtr, wParam, lParam);
 
 	case TB_MAPACCELERATORA:
 	case TB_MAPACCELERATORW:
-	    return TOOLBAR_MapAccelerator (hwnd, wParam, lParam);
+	    return TOOLBAR_MapAccelerator (infoPtr, wParam, lParam);
 
 	case TB_MARKBUTTON:
-	    return TOOLBAR_MarkButton (hwnd, wParam, lParam);
+	    return TOOLBAR_MarkButton (infoPtr, wParam, lParam);
 
 	case TB_MOVEBUTTON:
-	    return TOOLBAR_MoveButton (hwnd, wParam, lParam);
+	    return TOOLBAR_MoveButton (infoPtr, wParam, lParam);
 
 	case TB_PRESSBUTTON:
-	    return TOOLBAR_PressButton (hwnd, wParam, lParam);
+	    return TOOLBAR_PressButton (infoPtr, wParam, lParam);
 
 	case TB_REPLACEBITMAP:
-            return TOOLBAR_ReplaceBitmap (hwnd, lParam);
+            return TOOLBAR_ReplaceBitmap (infoPtr, lParam);
 
 	case TB_SAVERESTOREA:
-	    return TOOLBAR_SaveRestoreA (hwnd, wParam, (LPTBSAVEPARAMSA)lParam);
+	    return TOOLBAR_SaveRestoreA (infoPtr, wParam, (LPTBSAVEPARAMSA)lParam);
 
 	case TB_SAVERESTOREW:
-	    return TOOLBAR_SaveRestoreW (hwnd, wParam, (LPTBSAVEPARAMSW)lParam);
+	    return TOOLBAR_SaveRestoreW (infoPtr, wParam, (LPTBSAVEPARAMSW)lParam);
 
 	case TB_SETANCHORHIGHLIGHT:
-	    return TOOLBAR_SetAnchorHighlight (hwnd, wParam);
+	    return TOOLBAR_SetAnchorHighlight (infoPtr, wParam);
 
 	case TB_SETBITMAPSIZE:
-	    return TOOLBAR_SetBitmapSize (hwnd, wParam, lParam);
+	    return TOOLBAR_SetBitmapSize (infoPtr, wParam, lParam);
 
 	case TB_SETBUTTONINFOA:
-	    return TOOLBAR_SetButtonInfoA (hwnd, wParam, lParam);
+	    return TOOLBAR_SetButtonInfoA (infoPtr, wParam, lParam);
 
 	case TB_SETBUTTONINFOW:
-	    return TOOLBAR_SetButtonInfoW (hwnd, wParam, lParam);
+	    return TOOLBAR_SetButtonInfoW (infoPtr, wParam, lParam);
 
 	case TB_SETBUTTONSIZE:
-	    return TOOLBAR_SetButtonSize (hwnd, lParam);
+	    return TOOLBAR_SetButtonSize (infoPtr, lParam);
 
 	case TB_SETBUTTONWIDTH:
-	    return TOOLBAR_SetButtonWidth (hwnd, lParam);
+	    return TOOLBAR_SetButtonWidth (infoPtr, lParam);
 
 	case TB_SETCMDID:
-	    return TOOLBAR_SetCmdId (hwnd, wParam, lParam);
+	    return TOOLBAR_SetCmdId (infoPtr, wParam, lParam);
 
 	case TB_SETDISABLEDIMAGELIST:
-	    return TOOLBAR_SetDisabledImageList (hwnd, wParam, lParam);
+	    return TOOLBAR_SetDisabledImageList (infoPtr, wParam, lParam);
 
 	case TB_SETDRAWTEXTFLAGS:
-	    return TOOLBAR_SetDrawTextFlags (hwnd, wParam, lParam);
+	    return TOOLBAR_SetDrawTextFlags (infoPtr, wParam, lParam);
 
 	case TB_SETEXTENDEDSTYLE:
-	    return TOOLBAR_SetExtendedStyle (hwnd, lParam);
+	    return TOOLBAR_SetExtendedStyle (infoPtr, lParam);
 
 	case TB_SETHOTIMAGELIST:
-	    return TOOLBAR_SetHotImageList (hwnd, wParam, lParam);
+	    return TOOLBAR_SetHotImageList (infoPtr, wParam, lParam);
 
 	case TB_SETHOTITEM:
-	    return TOOLBAR_SetHotItem (hwnd, wParam);
+	    return TOOLBAR_SetHotItem (infoPtr, wParam);
 
 	case TB_SETIMAGELIST:
-	    return TOOLBAR_SetImageList (hwnd, wParam, lParam);
+	    return TOOLBAR_SetImageList (infoPtr, wParam, lParam);
 
 	case TB_SETINDENT:
-	    return TOOLBAR_SetIndent (hwnd, wParam);
+	    return TOOLBAR_SetIndent (infoPtr, wParam);
 
 	case TB_SETINSERTMARK:
-	    return TOOLBAR_SetInsertMark (hwnd, lParam);
+	    return TOOLBAR_SetInsertMark (infoPtr, lParam);
 
 	case TB_SETINSERTMARKCOLOR:
-	    return TOOLBAR_SetInsertMarkColor (hwnd, lParam);
+	    return TOOLBAR_SetInsertMarkColor (infoPtr, lParam);
 
 	case TB_SETMAXTEXTROWS:
-	    return TOOLBAR_SetMaxTextRows (hwnd, wParam);
+	    return TOOLBAR_SetMaxTextRows (infoPtr, wParam);
 
 	case TB_SETPADDING:
-	    return TOOLBAR_SetPadding (hwnd, lParam);
+	    return TOOLBAR_SetPadding (infoPtr, lParam);
 
 	case TB_SETPARENT:
-	    return TOOLBAR_SetParent (hwnd, wParam);
+	    return TOOLBAR_SetParent (infoPtr, wParam);
 
 	case TB_SETROWS:
-	    return TOOLBAR_SetRows (hwnd, wParam, lParam);
+	    return TOOLBAR_SetRows (infoPtr, wParam, lParam);
 
 	case TB_SETSTATE:
-	    return TOOLBAR_SetState (hwnd, wParam, lParam);
+	    return TOOLBAR_SetState (infoPtr, wParam, lParam);
 
 	case TB_SETSTYLE:
-	    return TOOLBAR_SetStyle (hwnd, lParam);
+	    return TOOLBAR_SetStyle (infoPtr, lParam);
 
 	case TB_SETTOOLTIPS:
-	    return TOOLBAR_SetToolTips (hwnd, wParam, lParam);
+	    return TOOLBAR_SetToolTips (infoPtr, wParam, lParam);
 
 	case TB_SETUNICODEFORMAT:
-	    return TOOLBAR_SetUnicodeFormat (hwnd, wParam);
+	    return TOOLBAR_SetUnicodeFormat (infoPtr, wParam);
 
 	case TB_UNKWN45D:
 	    return TOOLBAR_Unkwn45D(hwnd, wParam, lParam);
 
 	case TB_SETHOTITEM2:
-	    return TOOLBAR_SetHotItem2 (hwnd, wParam, lParam);
+	    return TOOLBAR_SetHotItem2 (infoPtr, wParam, lParam);
 
 	case TB_SETLISTGAP:
-	    return TOOLBAR_SetListGap(hwnd, wParam);
+	    return TOOLBAR_SetListGap(infoPtr, wParam);
 
 	case TB_GETIMAGELISTCOUNT:
-	    return TOOLBAR_GetImageListCount(hwnd, wParam, lParam);
+	    return TOOLBAR_GetImageListCount(infoPtr, wParam, lParam);
 
 	case TB_GETIDEALSIZE:
-	    return TOOLBAR_GetIdealSize (hwnd, wParam, lParam);
+	    return TOOLBAR_GetIdealSize (infoPtr, wParam, lParam);
 
 	case TB_UNKWN464:
 	    return TOOLBAR_Unkwn464(hwnd, wParam, lParam);
@@ -6923,17 +6786,17 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
 /*	case TB_GETCOLORSCHEME:			*/ /* identical to CCM_ */
 	case CCM_GETCOLORSCHEME:
-	    return TOOLBAR_GetColorScheme (hwnd, (LPCOLORSCHEME)lParam);
+	    return TOOLBAR_GetColorScheme (infoPtr, (LPCOLORSCHEME)lParam);
 
 /*	case TB_SETCOLORSCHEME:			*/ /* identical to CCM_ */
 	case CCM_SETCOLORSCHEME:
-	    return TOOLBAR_SetColorScheme (hwnd, (LPCOLORSCHEME)lParam);
+	    return TOOLBAR_SetColorScheme (infoPtr, (LPCOLORSCHEME)lParam);
 
 	case CCM_GETVERSION:
-	    return TOOLBAR_GetVersion (hwnd);
+	    return TOOLBAR_GetVersion (infoPtr);
 
 	case CCM_SETVERSION:
-	    return TOOLBAR_SetVersion (hwnd, (INT)wParam);
+	    return TOOLBAR_SetVersion (infoPtr, (INT)wParam);
 

 /*	case WM_CHAR: */
@@ -6942,42 +6805,42 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return TOOLBAR_Create (hwnd, lParam);
 
 	case WM_DESTROY:
-	  return TOOLBAR_Destroy (hwnd);
+	  return TOOLBAR_Destroy (infoPtr);
 
 	case WM_ERASEBKGND:
-	    return TOOLBAR_EraseBackground (hwnd, wParam, lParam);
+	    return TOOLBAR_EraseBackground (infoPtr, wParam, lParam);
 
 	case WM_GETFONT:
-		return TOOLBAR_GetFont (hwnd);
+		return TOOLBAR_GetFont (infoPtr);
 
 	case WM_KEYDOWN:
-	    return TOOLBAR_KeyDown (hwnd, wParam, lParam);
+	    return TOOLBAR_KeyDown (infoPtr, wParam, lParam);
 
 /*	case WM_KILLFOCUS: */
 
 	case WM_LBUTTONDBLCLK:
-	    return TOOLBAR_LButtonDblClk (hwnd, wParam, lParam);
+	    return TOOLBAR_LButtonDblClk (infoPtr, wParam, lParam);
 
 	case WM_LBUTTONDOWN:
-	    return TOOLBAR_LButtonDown (hwnd, wParam, lParam);
+	    return TOOLBAR_LButtonDown (infoPtr, wParam, lParam);
 
 	case WM_LBUTTONUP:
-	    return TOOLBAR_LButtonUp (hwnd, wParam, lParam);
+	    return TOOLBAR_LButtonUp (infoPtr, wParam, lParam);
 
 	case WM_RBUTTONUP:
-	    return TOOLBAR_RButtonUp (hwnd, wParam, lParam);
+	    return TOOLBAR_RButtonUp (infoPtr, wParam, lParam);
 
 	case WM_RBUTTONDBLCLK:
-	    return TOOLBAR_RButtonDblClk (hwnd, wParam, lParam);
+	    return TOOLBAR_RButtonDblClk (infoPtr, wParam, lParam);
 
 	case WM_MOUSEMOVE:
-	    return TOOLBAR_MouseMove (hwnd, wParam, lParam);
+	    return TOOLBAR_MouseMove (infoPtr, wParam, lParam);
 
 	case WM_MOUSELEAVE:
-	    return TOOLBAR_MouseLeave (hwnd);
+	    return TOOLBAR_MouseLeave (infoPtr);
 
 	case WM_CAPTURECHANGED:
-	    return TOOLBAR_CaptureChanged(hwnd);
+	    return TOOLBAR_CaptureChanged(infoPtr);
 
 	case WM_NCACTIVATE:
 	    return TOOLBAR_NCActivate (hwnd, wParam, lParam);
@@ -6992,29 +6855,29 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return TOOLBAR_NCPaint (hwnd, wParam, lParam);
 
 	case WM_NOTIFY:
-	    return TOOLBAR_Notify (hwnd, lParam);
+	    return TOOLBAR_Notify (infoPtr, lParam);
 
 	case WM_NOTIFYFORMAT:
 	    return TOOLBAR_NotifyFormat (infoPtr, wParam, lParam);
 
 	case WM_PRINTCLIENT:
 	case WM_PAINT:
-	    return TOOLBAR_Paint (hwnd, wParam);
+	    return TOOLBAR_Paint (infoPtr, wParam);
 
 	case WM_SETFOCUS:
-	    return TOOLBAR_SetFocus (hwnd);
+	    return TOOLBAR_SetFocus (infoPtr);
 
 	case WM_SETFONT:
-            return TOOLBAR_SetFont(hwnd, wParam, lParam);
+            return TOOLBAR_SetFont(infoPtr, wParam, lParam);
 
 	case WM_SETREDRAW:
-	    return TOOLBAR_SetRedraw (hwnd, wParam);
+	    return TOOLBAR_SetRedraw (infoPtr, wParam);
 
 	case WM_SIZE:
-	    return TOOLBAR_Size (hwnd);
+	    return TOOLBAR_Size (infoPtr);
 
 	case WM_STYLECHANGED:
-	    return TOOLBAR_StyleChanged (hwnd, (INT)wParam, (LPSTYLESTRUCT)lParam);
+	    return TOOLBAR_StyleChanged (infoPtr, (INT)wParam, (LPSTYLESTRUCT)lParam);
 
 	case WM_SYSCOLORCHANGE:
 	    return TOOLBAR_SysColorChange ();
-- 
1.5.6.5







More information about the wine-patches mailing list