[1/6] comctl32/header: Retrieve control data only once at WinProc call

Nikolay Sivov bunglehead at gmail.com
Sun May 17 15:11:37 CDT 2009


Animate, ComboBoxEx, DateTime, HotKey, IPAddress, ListView etc.
alredy use this optimization approach: call handlers with already
available pointer to control data to avoid multiple GetWindowLongPtr calls.

This patch does the same
with Header.

Changelog:
    - Retrieve control data only once at WinProc call

>From b6e802a129892d6f25406aea6a95958df99ea648 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sun, 17 May 2009 22:53:25 +0400
Subject: Retrieve control data only once at WinProc call

---
 dlls/comctl32/header.c |  523 ++++++++++++++++++++++--------------------------
 1 files changed, 240 insertions(+), 283 deletions(-)

diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index 7e6e0ff..c5542d7 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -64,6 +64,7 @@ typedef struct
 
 typedef struct
 {
+    HWND      hwndSelf;		/* Control window */
     HWND      hwndNotify;	/* Owner window to send notifications to */
     INT       nNotifyFormat;	/* format used for WM_NOTIFY messages */
     UINT      uNumItem;		/* number of items (columns) */
@@ -103,12 +104,11 @@ typedef struct
 #define HDI_UNKNOWN_FIELDS (~(HDI_SUPPORTED_FIELDS|HDI_UNSUPPORTED_FIELDS|HDI_DI_SETITEM))
 #define HDI_COMCTL32_4_0_FIELDS (HDI_WIDTH|HDI_TEXT|HDI_FORMAT|HDI_LPARAM|HDI_BITMAP)
 
-#define HEADER_GetInfoPtr(hwnd) ((HEADER_INFO *)GetWindowLongPtrW(hwnd,0))
 
-static BOOL HEADER_PrepareCallbackItems(HWND hwnd, INT iItem, INT reqMask);
+static BOOL HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask);
 static void HEADER_FreeCallbackItems(HEADER_ITEM *lpItem);
-static LRESULT HEADER_SendNotify(HWND hwnd, UINT code, NMHDR *hdr);
-static LRESULT HEADER_SendCtrlCustomDraw(HWND hwnd, DWORD dwDrawStage, HDC hdc, const RECT *rect);
+static LRESULT HEADER_SendNotify(const HEADER_INFO *infoPtr, UINT code, NMHDR *hdr);
+static LRESULT HEADER_SendCtrlCustomDraw(const HEADER_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, const RECT *rect);
 
 static const WCHAR themeClass[] = {'H','e','a','d','e','r',0};
 
@@ -163,18 +163,16 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDI
 }
 
 static inline LRESULT
-HEADER_IndexToOrder (HWND hwnd, INT iItem)
+HEADER_IndexToOrder (const HEADER_INFO *infoPtr, INT iItem)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem = &infoPtr->items[iItem];
     return lpItem->iOrder;
 }
 

 static INT
-HEADER_OrderToIndex(HWND hwnd, WPARAM wParam)
+HEADER_OrderToIndex(const HEADER_INFO *infoPtr, WPARAM wParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     INT iorder = (INT)wParam;
 
     if ((iorder <0) || iorder >= infoPtr->uNumItem)
@@ -210,21 +208,20 @@ HEADER_ChangeItemOrder(const HEADER_INFO *infoPtr, INT iItem, INT iNewOrder)
 
 /* Note: if iItem is the last item then this function returns infoPtr->uNumItem */
 static INT
-HEADER_NextItem(HWND hwnd, INT iItem)
+HEADER_NextItem(const HEADER_INFO *infoPtr, INT iItem)
 {
-    return HEADER_OrderToIndex(hwnd, HEADER_IndexToOrder(hwnd, iItem)+1);
+    return HEADER_OrderToIndex(infoPtr, HEADER_IndexToOrder(infoPtr, iItem)+1);
 }
 
 static INT
-HEADER_PrevItem(HWND hwnd, INT iItem)
+HEADER_PrevItem(const HEADER_INFO *infoPtr, INT iItem)
 {
-    return HEADER_OrderToIndex(hwnd, HEADER_IndexToOrder(hwnd, iItem)-1);
+    return HEADER_OrderToIndex(infoPtr, HEADER_IndexToOrder(infoPtr, iItem)-1);
 }
 
 static void
-HEADER_SetItemBounds (HWND hwnd)
+HEADER_SetItemBounds (HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *phdi;
     RECT rect;
     unsigned int i;
@@ -235,11 +232,11 @@ HEADER_SetItemBounds (HWND hwnd)
     if (infoPtr->uNumItem == 0)
         return;
 
-    GetClientRect (hwnd, &rect);
+    GetClientRect (infoPtr->hwndSelf, &rect);
 
     x = rect.left;
     for (i = 0; i < infoPtr->uNumItem; i++) {
-        phdi = &infoPtr->items[HEADER_OrderToIndex(hwnd,i)];
+        phdi = &infoPtr->items[HEADER_OrderToIndex(infoPtr,i)];
         phdi->rect.top = rect.top;
         phdi->rect.bottom = rect.bottom;
         phdi->rect.left = x;
@@ -249,16 +246,14 @@ HEADER_SetItemBounds (HWND hwnd)
 }
 
 static LRESULT
-HEADER_Size (HWND hwnd)
+HEADER_Size (HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-
     infoPtr->bRectsValid = FALSE;
 
     return 0;
 }
 
-static void HEADER_GetHotDividerRect(HWND hwnd, const HEADER_INFO *infoPtr, RECT *r)
+static void HEADER_GetHotDividerRect(const HEADER_INFO *infoPtr, RECT *r)
 {
     INT iDivider = infoPtr->iHotDivider;
     if (infoPtr->uNumItem > 0)
@@ -273,7 +268,7 @@ static void HEADER_GetHotDividerRect(HWND hwnd, const HEADER_INFO *infoPtr, RECT
         }
         else
         {
-            lpItem = &infoPtr->items[HEADER_OrderToIndex(hwnd, infoPtr->uNumItem-1)];
+            lpItem = &infoPtr->items[HEADER_OrderToIndex(infoPtr, infoPtr->uNumItem-1)];
             r->left  = lpItem->rect.right - HOT_DIVIDER_WIDTH/2;
             r->right = lpItem->rect.right + HOT_DIVIDER_WIDTH/2;
         }
@@ -283,7 +278,7 @@ static void HEADER_GetHotDividerRect(HWND hwnd, const HEADER_INFO *infoPtr, RECT
     else
     {
         RECT clientRect;
-        GetClientRect(hwnd, &clientRect);
+        GetClientRect(infoPtr->hwndSelf, &clientRect);
         *r = clientRect;
         r->right = r->left + HOT_DIVIDER_WIDTH/2;
     }
@@ -291,13 +286,12 @@ static void HEADER_GetHotDividerRect(HWND hwnd, const HEADER_INFO *infoPtr, RECT
 

 static INT
-HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags)
+HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *phdi = &infoPtr->items[iItem];
     RECT r;
     INT  oldBkMode;
-    HTHEME theme = GetWindowTheme (hwnd);
+    HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
     NMCUSTOMDRAW nmcd;
 
     TRACE("DrawItem(iItem %d bHotTrack %d unicode flag %d)\n", iItem, bHotTrack, (infoPtr->nNotifyFormat == NFR_UNICODE));
@@ -321,7 +315,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags
         nmcd.uItemState   = phdi->bDown ? CDIS_SELECTED : 0;
         nmcd.lItemlParam  = phdi->lParam;
 
-        lCDItemFlags = HEADER_SendNotify(hwnd, NM_CUSTOMDRAW, (NMHDR *)&nmcd);
+        lCDItemFlags = HEADER_SendNotify(infoPtr, NM_CUSTOMDRAW, (NMHDR *)&nmcd);
         if (lCDItemFlags & CDRF_SKIPDEFAULT)
             return phdi->rect.right;
     }
@@ -337,7 +331,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags
     else {
         HBRUSH hbr;
     
-        if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) {
+        if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & HDS_BUTTONS) {
             if (phdi->bDown) {
                 DrawEdge (hdc, &r, BDR_RAISEDOUTER,
                             BF_RECT | BF_FLAT | BF_MIDDLE | BF_ADJUST);
@@ -362,11 +356,11 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags
 	DRAWITEMSTRUCT dis;
 
 	dis.CtlType    = ODT_HEADER;
-	dis.CtlID      = GetWindowLongPtrW (hwnd, GWLP_ID);
+	dis.CtlID      = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
 	dis.itemID     = iItem;
 	dis.itemAction = ODA_DRAWENTIRE;
 	dis.itemState  = phdi->bDown ? ODS_SELECTED : 0;
-	dis.hwndItem   = hwnd;
+	dis.hwndItem   = infoPtr->hwndSelf;
 	dis.hDC        = hdc;
 	dis.rcItem     = phdi->rect;
 	dis.itemData   = phdi->lParam;
@@ -384,7 +378,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags
 	     cw, tw, iw, bw;
 	BITMAP bmp;
 
-        HEADER_PrepareCallbackItems(hwnd, iItem, HDI_TEXT|HDI_IMAGE);
+        HEADER_PrepareCallbackItems(infoPtr, iItem, HDI_TEXT|HDI_IMAGE);
 	cw = tw = iw = bw = 0;
 	rw = r.right - r.left;
 	rh = r.bottom - r.top;
@@ -458,7 +452,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags
 	}
 
 	if (iw || bw) {
-	    HDC hClipDC = GetDC(hwnd);
+	    HDC hClipDC = GetDC(infoPtr->hwndSelf);
 	    HRGN hClipRgn = CreateRectRgn(r.left, r.top, r.right, r.bottom);
 	    SelectClipRgn(hClipDC, hClipRgn);
 	    
@@ -477,7 +471,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags
 	    }
 
 	    DeleteObject(hClipRgn);
-	    ReleaseDC(hwnd, hClipDC);
+	    ReleaseDC(infoPtr->hwndSelf, hClipDC);
 	}
         
 	if (((phdi->fmt & HDF_STRING)
@@ -499,36 +493,34 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags
 }
 
 static void
-HEADER_DrawHotDivider(HWND hwnd, HDC hdc)
+HEADER_DrawHotDivider(const HEADER_INFO *infoPtr, HDC hdc)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HBRUSH brush;
     RECT r;
     
-    HEADER_GetHotDividerRect(hwnd, infoPtr, &r);
+    HEADER_GetHotDividerRect(infoPtr, &r);
     brush = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
     FillRect(hdc, &r, brush);
     DeleteObject(brush);
 }
 
 static void
-HEADER_Refresh (HWND hwnd, HDC hdc)
+HEADER_Refresh (HEADER_INFO *infoPtr, HDC hdc)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HFONT hFont, hOldFont;
     RECT rect, rcRest;
     HBRUSH hbrBk;
     UINT i;
     INT x;
     LRESULT lCDFlags;
-    HTHEME theme = GetWindowTheme (hwnd);
+    HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
 
     if (!infoPtr->bRectsValid)
-        HEADER_SetItemBounds(hwnd);
+        HEADER_SetItemBounds(infoPtr);
 
     /* get rect for the bar, adjusted for the border */
-    GetClientRect (hwnd, &rect);
-    lCDFlags = HEADER_SendCtrlCustomDraw(hwnd, CDDS_PREPAINT, hdc, &rect);
+    GetClientRect (infoPtr->hwndSelf, &rect);
+    lCDFlags = HEADER_SendCtrlCustomDraw(infoPtr, CDDS_PREPAINT, hdc, &rect);
     
     if (infoPtr->bDragging)
 	ImageList_DragShowNolock(FALSE);
@@ -544,9 +536,9 @@ HEADER_Refresh (HWND hwnd, HDC hdc)
 
     x = rect.left;
     for (i = 0; x <= rect.right && i < infoPtr->uNumItem; i++) {
-        int idx = HEADER_OrderToIndex(hwnd,i);
+        int idx = HEADER_OrderToIndex(infoPtr,i);
         if (RectVisible(hdc, &infoPtr->items[idx].rect))
-            HEADER_DrawItem(hwnd, hdc, idx, infoPtr->iHotItem == idx, lCDFlags);
+            HEADER_DrawItem(infoPtr, hdc, idx, infoPtr->iHotItem == idx, lCDFlags);
         x = infoPtr->items[idx].rect.right;
     }
 
@@ -557,7 +549,7 @@ HEADER_Refresh (HWND hwnd, HDC hdc)
             DrawThemeBackground(theme, hdc, HP_HEADERITEM, HIS_NORMAL, &rcRest, NULL);
         }
         else {
-            if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS)
+            if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & HDS_BUTTONS)
                 DrawEdge (hdc, &rcRest, EDGE_RAISED, BF_TOP|BF_LEFT|BF_BOTTOM|BF_SOFT|BF_MIDDLE);
             else
                 DrawEdge (hdc, &rcRest, EDGE_ETCHED, BF_BOTTOM|BF_MIDDLE);
@@ -565,39 +557,36 @@ HEADER_Refresh (HWND hwnd, HDC hdc)
     }
     
     if (infoPtr->iHotDivider != -1)
-        HEADER_DrawHotDivider(hwnd, hdc);
+        HEADER_DrawHotDivider(infoPtr, hdc);
 
     if (infoPtr->bDragging)
 	ImageList_DragShowNolock(TRUE);
     SelectObject (hdc, hOldFont);
     
     if (lCDFlags & CDRF_NOTIFYPOSTPAINT)
-        HEADER_SendCtrlCustomDraw(hwnd, CDDS_POSTPAINT, hdc, &rect);
+        HEADER_SendCtrlCustomDraw(infoPtr, CDDS_POSTPAINT, hdc, &rect);
 }
 

 static void
-HEADER_RefreshItem (HWND hwnd, INT iItem)
+HEADER_RefreshItem (HEADER_INFO *infoPtr, INT iItem)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-
     if (!infoPtr->bRectsValid)
-        HEADER_SetItemBounds(hwnd);
+        HEADER_SetItemBounds(infoPtr);
 
-    InvalidateRect(hwnd, &infoPtr->items[iItem].rect, FALSE);
+    InvalidateRect(infoPtr->hwndSelf, &infoPtr->items[iItem].rect, FALSE);
 }
 

 static void
-HEADER_InternalHitTest (HWND hwnd, const POINT *lpPt, UINT *pFlags, INT *pItem)
+HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pItem)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     RECT rect, rcTest;
     UINT iCount;
     INT width;
     BOOL bNoWidth;
 
-    GetClientRect (hwnd, &rect);
+    GetClientRect (infoPtr->hwndSelf, &rect);
 
     *pFlags = 0;
     bNoWidth = FALSE;
@@ -625,19 +614,19 @@ HEADER_InternalHitTest (HWND hwnd, const POINT *lpPt, UINT *pFlags, INT *pItem)
 			TRACE("ON HEADER %d\n", iCount);
 			return;
 		    }
-                    if (HEADER_IndexToOrder(hwnd, iCount) > 0) {
+                    if (HEADER_IndexToOrder(infoPtr, iCount) > 0) {
 			rcTest = rect;
 			rcTest.right = rcTest.left + DIVIDER_WIDTH;
 			if (PtInRect (&rcTest, *lpPt)) {
 			    if (bNoWidth) {
 				*pFlags |= HHT_ONDIVOPEN;
-                                *pItem = HEADER_PrevItem(hwnd, iCount);
+                                *pItem = HEADER_PrevItem(infoPtr, iCount);
 				TRACE("ON DIVOPEN %d\n", *pItem);
 				return;
 			    }
 			    else {
 				*pFlags |= HHT_ONDIVIDER;
-                                *pItem = HEADER_PrevItem(hwnd, iCount);
+                                *pItem = HEADER_PrevItem(infoPtr, iCount);
 				TRACE("ON DIVIDER %d\n", *pItem);
 				return;
 			    }
@@ -711,13 +700,13 @@ HEADER_InternalHitTest (HWND hwnd, const POINT *lpPt, UINT *pFlags, INT *pItem)
 

 static void
-HEADER_DrawTrackLine (HWND hwnd, HDC hdc, INT x)
+HEADER_DrawTrackLine (const HEADER_INFO *infoPtr, HDC hdc, INT x)
 {
     RECT rect;
     HPEN hOldPen;
     INT  oldRop;
 
-    GetClientRect (hwnd, &rect);
+    GetClientRect (infoPtr->hwndSelf, &rect);
 
     hOldPen = SelectObject (hdc, GetStockObject (BLACK_PEN));
     oldRop = SetROP2 (hdc, R2_XORPEN);
@@ -775,12 +764,10 @@ static UINT HEADER_NotifyCodeWtoA(UINT code)
 }
 
 static LRESULT
-HEADER_SendNotify(HWND hwnd, UINT code, NMHDR *nmhdr)
+HEADER_SendNotify(const HEADER_INFO *infoPtr, UINT code, NMHDR *nmhdr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-
-    nmhdr->hwndFrom = hwnd;
-    nmhdr->idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
+    nmhdr->hwndFrom = infoPtr->hwndSelf;
+    nmhdr->idFrom   = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
     nmhdr->code     = code;
 
     return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
@@ -788,14 +775,14 @@ HEADER_SendNotify(HWND hwnd, UINT code, NMHDR *nmhdr)
 }
 
 static BOOL
-HEADER_SendSimpleNotify (HWND hwnd, UINT code)
+HEADER_SendSimpleNotify (const HEADER_INFO *infoPtr, UINT code)
 {
     NMHDR nmhdr;
-    return (BOOL)HEADER_SendNotify(hwnd, code, &nmhdr);
+    return (BOOL)HEADER_SendNotify(infoPtr, code, &nmhdr);
 }
 
 static LRESULT
-HEADER_SendCtrlCustomDraw(HWND hwnd, DWORD dwDrawStage, HDC hdc, const RECT *rect)
+HEADER_SendCtrlCustomDraw(const HEADER_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, const RECT *rect)
 {
     NMCUSTOMDRAW nm;
     nm.dwDrawStage = dwDrawStage;
@@ -805,13 +792,12 @@ HEADER_SendCtrlCustomDraw(HWND hwnd, DWORD dwDrawStage, HDC hdc, const RECT *rec
     nm.uItemState = 0;
     nm.lItemlParam = 0;
 
-    return HEADER_SendNotify(hwnd, NM_CUSTOMDRAW, (NMHDR *)&nm);
+    return HEADER_SendNotify(infoPtr, NM_CUSTOMDRAW, (NMHDR *)&nm);
 }
 
 static BOOL
-HEADER_SendNotifyWithHDItemT(HWND hwnd, UINT code, INT iItem, HDITEMW *lpItem)
+HEADER_SendNotifyWithHDItemT(const HEADER_INFO *infoPtr, UINT code, INT iItem, HDITEMW *lpItem)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     NMHEADERW nmhdr;
     
     if (infoPtr->nNotifyFormat != NFR_UNICODE)
@@ -820,13 +806,12 @@ HEADER_SendNotifyWithHDItemT(HWND hwnd, UINT code, INT iItem, HDITEMW *lpItem)
     nmhdr.iButton = 0;
     nmhdr.pitem = lpItem;
 
-    return (BOOL)HEADER_SendNotify(hwnd, code, (NMHDR *)&nmhdr);
+    return (BOOL)HEADER_SendNotify(infoPtr, code, (NMHDR *)&nmhdr);
 }
 
 static BOOL
-HEADER_SendNotifyWithIntFieldT(HWND hwnd, UINT code, INT iItem, INT mask, INT iValue)
+HEADER_SendNotifyWithIntFieldT(const HEADER_INFO *infoPtr, UINT code, INT iItem, INT mask, INT iValue)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HDITEMW nmitem;
 
     /* copying only the iValue should be ok but to make the code more robust we copy everything */
@@ -852,7 +837,7 @@ HEADER_SendNotifyWithIntFieldT(HWND hwnd, UINT code, INT iItem, INT mask, INT iV
 	    ERR("invalid mask value 0x%x\n", iValue);
     }
 
-    return HEADER_SendNotifyWithHDItemT(hwnd, code, iItem, &nmitem);
+    return HEADER_SendNotifyWithHDItemT(infoPtr, code, iItem, &nmitem);
 }
 
 /**
@@ -871,9 +856,8 @@ HEADER_SendNotifyWithIntFieldT(HWND hwnd, UINT code, INT iItem, INT mask, INT iV
  * @return TRUE on success, else FALSE
  */
 static BOOL
-HEADER_PrepareCallbackItems(HWND hwnd, INT iItem, INT reqMask)
+HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem = &infoPtr->items[iItem];
     DWORD mask = reqMask & lpItem->callbackMask;
     NMHDDISPINFOW dispInfo;
@@ -889,8 +873,8 @@ HEADER_PrepareCallbackItems(HWND hwnd, INT iItem, INT reqMask)
     }
     
     memset(&dispInfo, 0, sizeof(NMHDDISPINFOW));
-    dispInfo.hdr.hwndFrom = hwnd;
-    dispInfo.hdr.idFrom   = GetWindowLongPtrW (hwnd, GWLP_ID);
+    dispInfo.hdr.hwndFrom = infoPtr->hwndSelf;
+    dispInfo.hdr.idFrom   = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
     if (infoPtr->nNotifyFormat == NFR_UNICODE)
     {
         dispInfo.hdr.code = HDN_GETDISPINFOW;
@@ -967,9 +951,8 @@ HEADER_FreeCallbackItems(HEADER_ITEM *lpItem)
 }
 
 static LRESULT
-HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
+HEADER_CreateDragImage (HEADER_INFO *infoPtr, WPARAM wParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);
     HEADER_ITEM *lpItem;
     HIMAGELIST himl;
     HBITMAP hMemory, hOldBitmap;
@@ -984,7 +967,7 @@ HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
         return FALSE;
 
     if (!infoPtr->bRectsValid)
-    	HEADER_SetItemBounds(hwnd);
+        HEADER_SetItemBounds(infoPtr);
 
     lpItem = &infoPtr->items[wParam];
     width = lpItem->rect.right - lpItem->rect.left;
@@ -999,11 +982,11 @@ HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
     hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject(SYSTEM_FONT);
     SelectObject(hMemoryDC, hFont);
 
-    GetClientRect(hwnd, &rc);
-    lCDFlags = HEADER_SendCtrlCustomDraw(hwnd, CDDS_PREPAINT, hMemoryDC, &rc);
-    HEADER_DrawItem(hwnd, hMemoryDC, wParam, FALSE, lCDFlags);
+    GetClientRect(infoPtr->hwndSelf, &rc);
+    lCDFlags = HEADER_SendCtrlCustomDraw(infoPtr, CDDS_PREPAINT, hMemoryDC, &rc);
+    HEADER_DrawItem(infoPtr, hMemoryDC, wParam, FALSE, lCDFlags);
     if (lCDFlags & CDRF_NOTIFYPOSTPAINT)
-        HEADER_SendCtrlCustomDraw(hwnd, CDDS_POSTPAINT, hMemoryDC, &rc);
+        HEADER_SendCtrlCustomDraw(infoPtr, CDDS_POSTPAINT, hMemoryDC, &rc);
     
     hMemory = SelectObject(hMemoryDC, hOldBitmap);
     DeleteDC(hMemoryDC);
@@ -1018,9 +1001,8 @@ HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
 }
 
 static LRESULT
-HEADER_SetHotDivider(HWND hwnd, WPARAM wParam, LPARAM lParam)
+HEADER_SetHotDivider(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);
     INT iDivider;
     RECT r;
     
@@ -1030,7 +1012,7 @@ HEADER_SetHotDivider(HWND hwnd, WPARAM wParam, LPARAM lParam)
         UINT flags;
         pt.x = (INT)(SHORT)LOWORD(lParam);
         pt.y = 0;
-        HEADER_InternalHitTest (hwnd, &pt, &flags, &iDivider);
+        HEADER_InternalHitTest (infoPtr, &pt, &flags, &iDivider);
         
         if (flags & HHT_TOLEFT)
             iDivider = 0;
@@ -1040,7 +1022,7 @@ HEADER_SetHotDivider(HWND hwnd, WPARAM wParam, LPARAM lParam)
         {
             HEADER_ITEM *lpItem = &infoPtr->items[iDivider];
             if (pt.x > (lpItem->rect.left+lpItem->rect.right)/2)
-                iDivider = HEADER_NextItem(hwnd, iDivider);
+                iDivider = HEADER_NextItem(infoPtr, iDivider);
         }
     }
     else
@@ -1054,23 +1036,22 @@ HEADER_SetHotDivider(HWND hwnd, WPARAM wParam, LPARAM lParam)
     {
         if (infoPtr->iHotDivider != -1)
         {
-            HEADER_GetHotDividerRect(hwnd, infoPtr, &r);
-            InvalidateRect(hwnd, &r, FALSE);
+            HEADER_GetHotDividerRect(infoPtr, &r);
+            InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
         }
         infoPtr->iHotDivider = iDivider;
         if (iDivider != -1)
         {
-            HEADER_GetHotDividerRect(hwnd, infoPtr, &r);
-            InvalidateRect(hwnd, &r, FALSE);
+            HEADER_GetHotDividerRect(infoPtr, &r);
+            InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
         }
     }
     return iDivider;
 }
 
 static LRESULT
-HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
+HEADER_DeleteItem (HEADER_INFO *infoPtr, WPARAM wParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);
     INT iItem = (INT)wParam;
     INT iOrder;
     UINT i;
@@ -1105,26 +1086,23 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
     for (i = 0; i < infoPtr->uNumItem; i++)
        TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
 
-    HEADER_SetItemBounds (hwnd);
-    InvalidateRect(hwnd, NULL, FALSE);
+    HEADER_SetItemBounds (infoPtr);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 
     return TRUE;
 }
 

 static LRESULT
-HEADER_GetImageList (HWND hwnd)
+HEADER_GetImageList (const HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-
     return (LRESULT)infoPtr->himl;
 }
 

 static LRESULT
-HEADER_GetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
+HEADER_GetItemT (const HEADER_INFO *infoPtr, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem;
     UINT mask;
 
@@ -1147,7 +1125,7 @@ HEADER_GetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
     }
     
     lpItem = &infoPtr->items[nItem];
-    HEADER_PrepareCallbackItems(hwnd, nItem, mask);
+    HEADER_PrepareCallbackItems(infoPtr, nItem, mask);
 
     if (mask & HDI_BITMAP)
         phdi->hbm = lpItem->hbm;
@@ -1181,17 +1159,15 @@ HEADER_GetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
 

 static inline LRESULT
-HEADER_GetItemCount (HWND hwnd)
+HEADER_GetItemCount (const HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     return infoPtr->uNumItem;
 }
 

 static LRESULT
-HEADER_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
+HEADER_GetItemRect (const HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     INT iItem = (INT)wParam;
     LPRECT lpRect = (LPRECT)lParam;
 
@@ -1208,10 +1184,9 @@ HEADER_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
 

 static LRESULT
-HEADER_GetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam)
+HEADER_GetOrderArray(const HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     LPINT order = (LPINT) lParam;
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
 
     if ((unsigned int)wParam <infoPtr->uNumItem)
       return FALSE;
@@ -1221,11 +1196,10 @@ HEADER_GetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 static LRESULT
-HEADER_SetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam)
+HEADER_SetOrderArray(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     int i;
     LPINT order = (LPINT) lParam;
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem;
 
     if ((unsigned int)wParam <infoPtr->uNumItem)
@@ -1237,24 +1211,23 @@ HEADER_SetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam)
 	lpItem->iOrder=i;
       }
     infoPtr->bRectsValid=0;
-    InvalidateRect(hwnd, NULL, FALSE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     return TRUE;
 }
 
 static inline LRESULT
-HEADER_GetUnicodeFormat (HWND hwnd)
+HEADER_GetUnicodeFormat (const HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     return (infoPtr->nNotifyFormat == NFR_UNICODE);
 }
 

 static LRESULT
-HEADER_HitTest (HWND hwnd, LPARAM lParam)
+HEADER_HitTest (const HEADER_INFO *infoPtr, LPARAM lParam)
 {
     LPHDHITTESTINFO phti = (LPHDHITTESTINFO)lParam;
 
-    HEADER_InternalHitTest (hwnd, &phti->pt, &phti->flags, &phti->iItem);
+    HEADER_InternalHitTest (infoPtr, &phti->pt, &phti->flags, &phti->iItem);
 
     if (phti->flags == HHT_NOWHERE)
         return -1;
@@ -1264,9 +1237,8 @@ HEADER_HitTest (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-HEADER_InsertItemT (HWND hwnd, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
+HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem;
     INT       iOrder;
     UINT      i;
@@ -1324,25 +1296,24 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
     if (phdi->mask & HDI_IMAGE)
         lpItem->fmt |= HDF_IMAGE;
 
-    HEADER_SetItemBounds (hwnd);
-    InvalidateRect(hwnd, NULL, FALSE);
+    HEADER_SetItemBounds (infoPtr);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 
     return nItem;
 }
 

 static LRESULT
-HEADER_Layout (HWND hwnd, LPARAM lParam)
+HEADER_Layout (HEADER_INFO *infoPtr, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     LPHDLAYOUT lpLayout = (LPHDLAYOUT)lParam;
 
-    lpLayout->pwpos->hwnd = hwnd;
+    lpLayout->pwpos->hwnd = infoPtr->hwndSelf;
     lpLayout->pwpos->hwndInsertAfter = 0;
     lpLayout->pwpos->x = lpLayout->prc->left;
     lpLayout->pwpos->y = lpLayout->prc->top;
     lpLayout->pwpos->cx = lpLayout->prc->right - lpLayout->prc->left;
-    if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_HIDDEN)
+    if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & HDS_HIDDEN)
         lpLayout->pwpos->cy = 0;
     else {
         lpLayout->pwpos->cy = infoPtr->nHeight;
@@ -1361,9 +1332,8 @@ HEADER_Layout (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-HEADER_SetImageList (HWND hwnd, HIMAGELIST himl)
+HEADER_SetImageList (HEADER_INFO *infoPtr, HIMAGELIST himl)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HIMAGELIST himlOld;
 
     TRACE("(himl %p)\n", himl);
@@ -1377,17 +1347,14 @@ HEADER_SetImageList (HWND hwnd, HIMAGELIST himl)
 

 static LRESULT
-HEADER_GetBitmapMargin(HWND hwnd)
+HEADER_GetBitmapMargin(const HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);
-    
     return infoPtr->iMargin;
 }
 
 static LRESULT
-HEADER_SetBitmapMargin(HWND hwnd, WPARAM wParam)
+HEADER_SetBitmapMargin(HEADER_INFO *infoPtr, WPARAM wParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     INT oldMargin = infoPtr->iMargin;
 
     infoPtr->iMargin = (INT)wParam;
@@ -1396,9 +1363,8 @@ HEADER_SetBitmapMargin(HWND hwnd, WPARAM wParam)
 }
 
 static LRESULT
-HEADER_SetItemT (HWND hwnd, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
+HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem;
     HDITEMW hdNotify;
     void *pvScratch;
@@ -1411,7 +1377,7 @@ HEADER_SetItemT (HWND hwnd, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
     TRACE("[nItem=%d]\n", nItem);
 
     HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch);
-    if (HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMCHANGINGW, nItem, &hdNotify))
+    if (HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGINGW, nItem, &hdNotify))
     {
         Free(pvScratch);
 	return FALSE;
@@ -1424,20 +1390,19 @@ HEADER_SetItemT (HWND hwnd, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
         if (phdi->iOrder >= 0 && phdi->iOrder < infoPtr->uNumItem)
             HEADER_ChangeItemOrder(infoPtr, nItem, phdi->iOrder);
 
-    HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMCHANGEDW, nItem, &hdNotify);
+    HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGEDW, nItem, &hdNotify);
 
-    HEADER_SetItemBounds (hwnd);
+    HEADER_SetItemBounds (infoPtr);
 
-    InvalidateRect(hwnd, NULL, FALSE);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 
     Free(pvScratch);
     return TRUE;
 }
 
 static inline LRESULT
-HEADER_SetUnicodeFormat (HWND hwnd, WPARAM wParam)
+HEADER_SetUnicodeFormat (HEADER_INFO *infoPtr, WPARAM wParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     BOOL bTemp = (infoPtr->nNotifyFormat == NFR_UNICODE);
 
     infoPtr->nNotifyFormat = ((BOOL)wParam ? NFR_UNICODE : NFR_ANSI);
@@ -1457,6 +1422,7 @@ HEADER_Create (HWND hwnd, LPARAM lParam)
     infoPtr = Alloc (sizeof(HEADER_INFO));
     SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
+    infoPtr->hwndSelf = hwnd;
     infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
     infoPtr->uNumItem = 0;
     infoPtr->hFont = 0;
@@ -1490,17 +1456,16 @@ HEADER_Create (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-HEADER_Destroy (HWND hwnd)
+HEADER_Destroy (HEADER_INFO *infoPtr)
 {
-    HTHEME theme = GetWindowTheme(hwnd);
+    HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
     CloseThemeData(theme);
     return 0;
 }
 
 static LRESULT
-HEADER_NCDestroy (HWND hwnd)
+HEADER_NCDestroy (HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     HEADER_ITEM *lpItem;
     INT nItem;
 
@@ -1517,7 +1482,7 @@ HEADER_NCDestroy (HWND hwnd)
     if (infoPtr->himl)
       ImageList_Destroy (infoPtr->himl);
 
-    SetWindowLongPtrW (hwnd, 0, 0);
+    SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
     Free (infoPtr);
 
     return 0;
@@ -1525,10 +1490,8 @@ HEADER_NCDestroy (HWND hwnd)
 

 static inline LRESULT
-HEADER_GetFont (HWND hwnd)
+HEADER_GetFont (const HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-
     return (LRESULT)infoPtr->hFont;
 }
 
@@ -1544,7 +1507,7 @@ HEADER_IsDragDistance(const HEADER_INFO *infoPtr, const POINT *pt)
 }
 
 static LRESULT
-HEADER_LButtonDblClk (HWND hwnd, LPARAM lParam)
+HEADER_LButtonDblClk (HEADER_INFO *infoPtr, LPARAM lParam)
 {
     POINT pt;
     UINT  flags;
@@ -1552,22 +1515,21 @@ HEADER_LButtonDblClk (HWND hwnd, LPARAM lParam)
 
     pt.x = (short)LOWORD(lParam);
     pt.y = (short)HIWORD(lParam);
-    HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
+    HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
 
-    if ((GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER))
-        HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMDBLCLICKW, nItem, NULL);
+    if ((GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER))
+        HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMDBLCLICKW, nItem, NULL);
     else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN))
-        HEADER_SendNotifyWithHDItemT(hwnd, HDN_DIVIDERDBLCLICKW, nItem, NULL);
+        HEADER_SendNotifyWithHDItemT(infoPtr, HDN_DIVIDERDBLCLICKW, nItem, NULL);
 
     return 0;
 }
 

 static LRESULT
-HEADER_LButtonDown (HWND hwnd, LPARAM lParam)
+HEADER_LButtonDown (HEADER_INFO *infoPtr, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-    DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
+    DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
     POINT pt;
     UINT  flags;
     INT   nItem;
@@ -1575,10 +1537,10 @@ HEADER_LButtonDown (HWND hwnd, LPARAM lParam)
 
     pt.x = (short)LOWORD(lParam);
     pt.y = (short)HIWORD(lParam);
-    HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
+    HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
 
     if ((dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER)) {
-	SetCapture (hwnd);
+	SetCapture (infoPtr->hwndSelf);
 	infoPtr->bCaptured = TRUE;
 	infoPtr->bPressed  = TRUE;
 	infoPtr->bDragging = FALSE;
@@ -1588,17 +1550,17 @@ HEADER_LButtonDown (HWND hwnd, LPARAM lParam)
 	infoPtr->items[nItem].bDown = TRUE;
 
 	/* Send WM_CUSTOMDRAW */
-	hdc = GetDC (hwnd);
-	HEADER_RefreshItem (hwnd, nItem);
-	ReleaseDC (hwnd, hdc);
+	hdc = GetDC (infoPtr->hwndSelf);
+	HEADER_RefreshItem (infoPtr, nItem);
+	ReleaseDC (infoPtr->hwndSelf, hdc);
 
 	TRACE("Pressed item %d!\n", nItem);
     }
     else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) {
         INT iCurrWidth = infoPtr->items[nItem].cxy;
-        if (!HEADER_SendNotifyWithIntFieldT(hwnd, HDN_BEGINTRACKW, nItem, HDI_WIDTH, iCurrWidth))
+        if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_BEGINTRACKW, nItem, HDI_WIDTH, iCurrWidth))
         {
-	    SetCapture (hwnd);
+	    SetCapture (infoPtr->hwndSelf);
 	    infoPtr->bCaptured = TRUE;
 	    infoPtr->bTracking = TRUE;
 	    infoPtr->iMoveItem = nItem;
@@ -1606,9 +1568,9 @@ HEADER_LButtonDown (HWND hwnd, LPARAM lParam)
 
 	    if (!(dwStyle & HDS_FULLDRAG)) {
 		infoPtr->xOldTrack = infoPtr->items[nItem].rect.right;
-		hdc = GetDC (hwnd);
-		HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
-		ReleaseDC (hwnd, hdc);
+		hdc = GetDC (infoPtr->hwndSelf);
+		HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
+		ReleaseDC (infoPtr->hwndSelf, hdc);
 	    }
 
 	    TRACE("Begin tracking item %d!\n", nItem);
@@ -1620,10 +1582,9 @@ HEADER_LButtonDown (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-HEADER_LButtonUp (HWND hwnd, LPARAM lParam)
+HEADER_LButtonUp (HEADER_INFO *infoPtr, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-    DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
+    DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
     POINT pt;
     UINT  flags;
     INT   nItem;
@@ -1631,7 +1592,7 @@ HEADER_LButtonUp (HWND hwnd, LPARAM lParam)
 
     pt.x = (INT)(SHORT)LOWORD(lParam);
     pt.y = (INT)(SHORT)HIWORD(lParam);
-    HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
+    HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
 
     if (infoPtr->bPressed) {
 	if (infoPtr->bDragging)
@@ -1649,32 +1610,32 @@ HEADER_LButtonUp (HWND hwnd, LPARAM lParam)
                 iNewOrder = infoPtr->uNumItem-1;
             else
 	    {
-                iNewOrder = HEADER_IndexToOrder(hwnd, infoPtr->iHotDivider);
+                iNewOrder = HEADER_IndexToOrder(infoPtr, infoPtr->iHotDivider);
                 if (iNewOrder > lpItem->iOrder)
                     iNewOrder--;
             }
 
             if (iNewOrder != -1 &&
-                !HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ENDDRAG, infoPtr->iMoveItem, HDI_ORDER, iNewOrder))
+                !HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ENDDRAG, infoPtr->iMoveItem, HDI_ORDER, iNewOrder))
             {
                 HEADER_ChangeItemOrder(infoPtr, infoPtr->iMoveItem, iNewOrder);
 		infoPtr->bRectsValid = FALSE;
-		InvalidateRect(hwnd, NULL, FALSE);
+		InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
 	    }
 	    else
-		InvalidateRect(hwnd, &infoPtr->items[infoPtr->iMoveItem].rect, FALSE);
+		InvalidateRect(infoPtr->hwndSelf, &infoPtr->items[infoPtr->iMoveItem].rect, FALSE);
 
             infoPtr->bDragging = FALSE;
-            HEADER_SetHotDivider(hwnd, FALSE, -1);
+            HEADER_SetHotDivider(infoPtr, FALSE, -1);
 	}
 	else if (!(dwStyle&HDS_DRAGDROP) || !HEADER_IsDragDistance(infoPtr, &pt))
 	{
 	    infoPtr->items[infoPtr->iMoveItem].bDown = FALSE;
-	    hdc = GetDC (hwnd);
-	    HEADER_RefreshItem (hwnd, infoPtr->iMoveItem);
-	    ReleaseDC (hwnd, hdc);
+	    hdc = GetDC (infoPtr->hwndSelf);
+	    HEADER_RefreshItem (infoPtr, infoPtr->iMoveItem);
+	    ReleaseDC (infoPtr->hwndSelf, hdc);
 
-	    HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMCLICKW, infoPtr->iMoveItem, NULL);
+	    HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCLICKW, infoPtr->iMoveItem, NULL);
 	}
 
 	TRACE("Released item %d!\n", infoPtr->iMoveItem);
@@ -1687,28 +1648,28 @@ HEADER_LButtonUp (HWND hwnd, LPARAM lParam)
 	TRACE("End tracking item %d!\n", infoPtr->iMoveItem);
 	infoPtr->bTracking = FALSE;
 
-        HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ENDTRACKW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
+        HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ENDTRACKW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
 
         if (!(dwStyle & HDS_FULLDRAG)) {
-	    hdc = GetDC (hwnd);
-	    HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
-            ReleaseDC (hwnd, hdc);
+	    hdc = GetDC (infoPtr->hwndSelf);
+	    HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
+            ReleaseDC (infoPtr->hwndSelf, hdc);
         }
           
-        if (!HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth))
+        if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth))
         {
             infoPtr->items[infoPtr->iMoveItem].cxy = iNewWidth;
-            HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ITEMCHANGEDW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
+            HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ITEMCHANGEDW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
         }
 
-	HEADER_SetItemBounds (hwnd);
-	InvalidateRect(hwnd, NULL, TRUE);
+	HEADER_SetItemBounds (infoPtr);
+	InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     }
 
     if (infoPtr->bCaptured) {
 	infoPtr->bCaptured = FALSE;
 	ReleaseCapture ();
-	HEADER_SendSimpleNotify (hwnd, NM_RELEASEDCAPTURE);
+	HEADER_SendSimpleNotify (infoPtr, NM_RELEASEDCAPTURE);
     }
 
     return 0;
@@ -1716,10 +1677,8 @@ HEADER_LButtonUp (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-HEADER_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
+HEADER_NotifyFormat (HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-
     switch (lParam)
     {
 	case NF_QUERY:
@@ -1728,7 +1687,7 @@ HEADER_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
 	case NF_REQUERY:
 	    infoPtr->nNotifyFormat =
 		SendMessageW ((HWND)wParam, WM_NOTIFYFORMAT,
-			      (WPARAM)hwnd, (LPARAM)NF_QUERY);
+			      (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
 	    return infoPtr->nNotifyFormat;
     }
 
@@ -1736,26 +1695,24 @@ HEADER_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
 }
 
 static LRESULT
-HEADER_MouseLeave (HWND hwnd)
+HEADER_MouseLeave (HEADER_INFO *infoPtr)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     /* Reset hot-tracked item when mouse leaves control. */
     INT oldHotItem = infoPtr->iHotItem;
-    HDC hdc = GetDC (hwnd);
+    HDC hdc = GetDC (infoPtr->hwndSelf);
 
     infoPtr->iHotItem = -1;
-    if (oldHotItem != -1) HEADER_RefreshItem (hwnd, oldHotItem);
-    ReleaseDC (hwnd, hdc);
+    if (oldHotItem != -1) HEADER_RefreshItem (infoPtr, oldHotItem);
+    ReleaseDC (infoPtr->hwndSelf, hdc);
 
     return 0;
 }
 

 static LRESULT
-HEADER_MouseMove (HWND hwnd, LPARAM lParam)
+HEADER_MouseMove (HEADER_INFO *infoPtr, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
-    DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
+    DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
     POINT pt;
     UINT  flags;
     INT   nItem, nWidth;
@@ -1763,12 +1720,12 @@ HEADER_MouseMove (HWND hwnd, LPARAM lParam)
     /* With theming, hottracking is always enabled */
     BOOL  hotTrackEnabled =
         ((dwStyle & HDS_BUTTONS) && (dwStyle & HDS_HOTTRACK))
-        || (GetWindowTheme (hwnd) != NULL);
+        || (GetWindowTheme (infoPtr->hwndSelf) != NULL);
     INT oldHotItem = infoPtr->iHotItem;
 
     pt.x = (INT)(SHORT)LOWORD(lParam);
     pt.y = (INT)(SHORT)HIWORD(lParam);
-    HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
+    HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
 
     if (hotTrackEnabled) {
 	if (flags & (HHT_ONHEADER | HHT_ONDIVIDER | HHT_ONDIVOPEN))
@@ -1782,9 +1739,9 @@ HEADER_MouseMove (HWND hwnd, LPARAM lParam)
 	if (infoPtr->bPressed && !infoPtr->bDragging && dwStyle&HDS_DRAGDROP
 	    && HEADER_IsDragDistance(infoPtr, &pt))
 	{
-            if (!HEADER_SendNotifyWithHDItemT(hwnd, HDN_BEGINDRAG, infoPtr->iMoveItem, NULL))
+            if (!HEADER_SendNotifyWithHDItemT(infoPtr, HDN_BEGINDRAG, infoPtr->iMoveItem, NULL))
 	    {
-		HIMAGELIST hDragItem = (HIMAGELIST)HEADER_CreateDragImage(hwnd, infoPtr->iMoveItem);
+		HIMAGELIST hDragItem = (HIMAGELIST)HEADER_CreateDragImage(infoPtr, infoPtr->iMoveItem);
 		if (hDragItem != NULL)
 		{
 		    HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
@@ -1802,9 +1759,9 @@ HEADER_MouseMove (HWND hwnd, LPARAM lParam)
 	    POINT drag;
 	    drag.x = pt.x;
 	    drag.y = 0;
-	    ClientToScreen(hwnd, &drag);
+	    ClientToScreen(infoPtr->hwndSelf, &drag);
 	    ImageList_DragMove(drag.x, drag.y);
-	    HEADER_SetHotDivider(hwnd, TRUE, lParam);
+	    HEADER_SetHotDivider(infoPtr, TRUE, lParam);
 	}
 	
 	if (infoPtr->bPressed && !infoPtr->bDragging) {
@@ -1814,9 +1771,9 @@ HEADER_MouseMove (HWND hwnd, LPARAM lParam)
 	    else
 		infoPtr->items[infoPtr->iMoveItem].bDown = FALSE;
             if (oldState != infoPtr->items[infoPtr->iMoveItem].bDown) {
-                hdc = GetDC (hwnd);
-	        HEADER_RefreshItem (hwnd, infoPtr->iMoveItem);
-	        ReleaseDC (hwnd, hdc);
+                hdc = GetDC (infoPtr->hwndSelf);
+	        HEADER_RefreshItem (infoPtr, infoPtr->iMoveItem);
+	        ReleaseDC (infoPtr->hwndSelf, hdc);
             }
 
 	    TRACE("Moving pressed item %d!\n", infoPtr->iMoveItem);
@@ -1825,7 +1782,7 @@ HEADER_MouseMove (HWND hwnd, LPARAM lParam)
 	    if (dwStyle & HDS_FULLDRAG) {
                 HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
                 nWidth = pt.x - lpItem->rect.left + infoPtr->xTrackOffset;
-                if (!HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, nWidth))
+                if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, nWidth))
 		{
                     INT nOldWidth = lpItem->rect.right - lpItem->rect.left;
                     RECT rcClient;
@@ -1833,30 +1790,30 @@ HEADER_MouseMove (HWND hwnd, LPARAM lParam)
                     
                     if (nWidth < 0) nWidth = 0;
                     infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;
-                    HEADER_SetItemBounds(hwnd);
+                    HEADER_SetItemBounds(infoPtr);
                     
-                    GetClientRect(hwnd, &rcClient);
+                    GetClientRect(infoPtr->hwndSelf, &rcClient);
                     rcScroll = rcClient;
                     rcScroll.left = lpItem->rect.left + nOldWidth;
-                    ScrollWindowEx(hwnd, nWidth - nOldWidth, 0, &rcScroll, &rcClient, NULL, NULL, 0);
-                    InvalidateRect(hwnd, &lpItem->rect, FALSE);
-                    UpdateWindow(hwnd);
+                    ScrollWindowEx(infoPtr->hwndSelf, nWidth - nOldWidth, 0, &rcScroll, &rcClient, NULL, NULL, 0);
+                    InvalidateRect(infoPtr->hwndSelf, &lpItem->rect, FALSE);
+                    UpdateWindow(infoPtr->hwndSelf);
                     
-                    HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ITEMCHANGEDW, infoPtr->iMoveItem, HDI_WIDTH, nWidth);
+                    HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ITEMCHANGEDW, infoPtr->iMoveItem, HDI_WIDTH, nWidth);
 		}
 	    }
 	    else {
                 INT iTrackWidth;
-		hdc = GetDC (hwnd);
-		HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
+		hdc = GetDC (infoPtr->hwndSelf);
+		HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
 		infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset;
 		if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left)
 		    infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left;
-		HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
-		ReleaseDC (hwnd, hdc);
+		HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
+		ReleaseDC (infoPtr->hwndSelf, hdc);
                 iTrackWidth = infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left;
                 /* FIXME: should stop tracking if HDN_TRACK returns TRUE */
-                HEADER_SendNotifyWithIntFieldT(hwnd, HDN_TRACKW, infoPtr->iMoveItem, HDI_WIDTH, iTrackWidth);
+                HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_TRACKW, infoPtr->iMoveItem, HDI_WIDTH, iTrackWidth);
 	    }
 
 	    TRACE("Tracking item %d!\n", infoPtr->iMoveItem);
@@ -1866,14 +1823,14 @@ HEADER_MouseMove (HWND hwnd, LPARAM lParam)
     if (hotTrackEnabled) {
         TRACKMOUSEEVENT tme;
         if (oldHotItem != infoPtr->iHotItem && !infoPtr->bDragging) {
-	    hdc = GetDC (hwnd);
-	    if (oldHotItem != -1) HEADER_RefreshItem (hwnd, oldHotItem);
-	    if (infoPtr->iHotItem != -1) HEADER_RefreshItem (hwnd, infoPtr->iHotItem);
-	    ReleaseDC (hwnd, hdc);
+	    hdc = GetDC (infoPtr->hwndSelf);
+	    if (oldHotItem != -1) HEADER_RefreshItem (infoPtr, oldHotItem);
+	    if (infoPtr->iHotItem != -1) HEADER_RefreshItem (infoPtr, infoPtr->iHotItem);
+	    ReleaseDC (infoPtr->hwndSelf, hdc);
         }
         tme.cbSize = sizeof( tme );
         tme.dwFlags = TME_LEAVE;
-        tme.hwndTrack = hwnd;
+        tme.hwndTrack = infoPtr->hwndSelf;
         TrackMouseEvent( &tme );
     }
 
@@ -1882,21 +1839,21 @@ HEADER_MouseMove (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-HEADER_Paint (HWND hwnd, WPARAM wParam)
+HEADER_Paint (HEADER_INFO *infoPtr, WPARAM wParam)
 {
     HDC hdc;
     PAINTSTRUCT ps;
 
-    hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
-    HEADER_Refresh (hwnd, hdc);
+    hdc = wParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : (HDC)wParam;
+    HEADER_Refresh (infoPtr, hdc);
     if(!wParam)
-	EndPaint (hwnd, &ps);
+	EndPaint (infoPtr->hwndSelf, &ps);
     return 0;
 }
 

 static LRESULT
-HEADER_RButtonUp (HWND hwnd, LPARAM lParam)
+HEADER_RButtonUp (HEADER_INFO *infoPtr, LPARAM lParam)
 {
     BOOL bRet;
     POINT pt;
@@ -1905,22 +1862,21 @@ HEADER_RButtonUp (HWND hwnd, LPARAM lParam)
     pt.y = (short)HIWORD(lParam);
 
     /* Send a Notify message */
-    bRet = HEADER_SendSimpleNotify (hwnd, NM_RCLICK);
+    bRet = HEADER_SendSimpleNotify (infoPtr, NM_RCLICK);
 
     /* Change to screen coordinate for WM_CONTEXTMENU */
-    ClientToScreen(hwnd, &pt);
+    ClientToScreen(infoPtr->hwndSelf, &pt);
 
     /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
-    SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y));
+    SendMessageW( infoPtr->hwndSelf, WM_CONTEXTMENU, (WPARAM) infoPtr->hwndSelf, MAKELPARAM(pt.x, pt.y));
 
     return bRet;
 }
 

 static LRESULT
-HEADER_SetCursor (HWND hwnd, LPARAM lParam)
+HEADER_SetCursor (HEADER_INFO *infoPtr, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     POINT pt;
     UINT  flags;
     INT   nItem;
@@ -1928,9 +1884,9 @@ HEADER_SetCursor (HWND hwnd, LPARAM lParam)
     TRACE("code=0x%X  id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
 
     GetCursorPos (&pt);
-    ScreenToClient (hwnd, &pt);
+    ScreenToClient (infoPtr->hwndSelf, &pt);
 
-    HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
+    HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
 
     if (flags == HHT_ONDIVIDER)
         SetCursor (infoPtr->hcurDivider);
@@ -1944,9 +1900,8 @@ HEADER_SetCursor (HWND hwnd, LPARAM lParam)
 

 static LRESULT
-HEADER_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
+HEADER_SetFont (HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
     TEXTMETRICW tm;
     HFONT hFont, hOldFont;
     HDC hdc;
@@ -1965,31 +1920,31 @@ HEADER_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
     infoPtr->bRectsValid = FALSE;
 
     if (lParam) {
-        InvalidateRect(hwnd, NULL, FALSE);
+        InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     }
 
     return 0;
 }
 
-static LRESULT HEADER_SetRedraw(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT HEADER_SetRedraw(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
     /* ignoring the InvalidateRect calls is handled by user32. But some apps expect
      * that we invalidate the header and this has to be done manually  */
     LRESULT ret;
 
-    ret = DefWindowProcW(hwnd, WM_SETREDRAW, wParam, lParam);
+    ret = DefWindowProcW(infoPtr->hwndSelf, WM_SETREDRAW, wParam, lParam);
     if (wParam)
-        InvalidateRect(hwnd, NULL, TRUE);
+        InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
     return ret;
 }
 
 /* Update the theme handle after a theme change */
-static LRESULT HEADER_ThemeChanged(HWND hwnd)
+static LRESULT HEADER_ThemeChanged(const HEADER_INFO *infoPtr)
 {
-    HTHEME theme = GetWindowTheme(hwnd);
+    HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
     CloseThemeData(theme);
-    OpenThemeData(hwnd, themeClass);
-    InvalidateRect(hwnd, NULL, FALSE);
+    OpenThemeData(infoPtr->hwndSelf, themeClass);
+    InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
     return 0;
 }
 
@@ -1997,84 +1952,86 @@ static LRESULT HEADER_ThemeChanged(HWND hwnd)
 static LRESULT WINAPI
 HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
+    HEADER_INFO *infoPtr = (HEADER_INFO *)GetWindowLongPtrW(hwnd, 0);
+
     TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx\n", hwnd, msg, wParam, lParam);
-    if (!HEADER_GetInfoPtr (hwnd) && (msg != WM_CREATE))
+    if (!infoPtr && (msg != WM_CREATE))
 	return DefWindowProcW (hwnd, msg, wParam, lParam);
     switch (msg) {
 /*	case HDM_CLEARFILTER: */
 
 	case HDM_CREATEDRAGIMAGE:
-	    return HEADER_CreateDragImage (hwnd, wParam);
+	    return HEADER_CreateDragImage (infoPtr, wParam);
 
 	case HDM_DELETEITEM:
-	    return HEADER_DeleteItem (hwnd, wParam);
+	    return HEADER_DeleteItem (infoPtr, wParam);
 
 /*	case HDM_EDITFILTER: */
 
 	case HDM_GETBITMAPMARGIN:
-	    return HEADER_GetBitmapMargin(hwnd);
+	    return HEADER_GetBitmapMargin(infoPtr);
 
 	case HDM_GETIMAGELIST:
-	    return HEADER_GetImageList (hwnd);
+	    return HEADER_GetImageList (infoPtr);
 
 	case HDM_GETITEMA:
 	case HDM_GETITEMW:
-	    return HEADER_GetItemT (hwnd, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_GETITEMW);
+	    return HEADER_GetItemT (infoPtr, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_GETITEMW);
 
 	case HDM_GETITEMCOUNT:
-	    return HEADER_GetItemCount (hwnd);
+	    return HEADER_GetItemCount (infoPtr);
 
 	case HDM_GETITEMRECT:
-	    return HEADER_GetItemRect (hwnd, wParam, lParam);
+	    return HEADER_GetItemRect (infoPtr, wParam, lParam);
 
 	case HDM_GETORDERARRAY:
-	    return HEADER_GetOrderArray(hwnd, wParam, lParam);
+	    return HEADER_GetOrderArray(infoPtr, wParam, lParam);
 
 	case HDM_GETUNICODEFORMAT:
-	    return HEADER_GetUnicodeFormat (hwnd);
+	    return HEADER_GetUnicodeFormat (infoPtr);
 
 	case HDM_HITTEST:
-	    return HEADER_HitTest (hwnd, lParam);
+	    return HEADER_HitTest (infoPtr, lParam);
 
 	case HDM_INSERTITEMA:
 	case HDM_INSERTITEMW:
-	    return HEADER_InsertItemT (hwnd, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_INSERTITEMW);
+	    return HEADER_InsertItemT (infoPtr, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_INSERTITEMW);
 
 	case HDM_LAYOUT:
-	    return HEADER_Layout (hwnd, lParam);
+	    return HEADER_Layout (infoPtr, lParam);
 
 	case HDM_ORDERTOINDEX:
-	    return HEADER_OrderToIndex(hwnd, wParam);
+	    return HEADER_OrderToIndex(infoPtr, wParam);
 
 	case HDM_SETBITMAPMARGIN:
-	    return HEADER_SetBitmapMargin(hwnd, wParam);
+	    return HEADER_SetBitmapMargin(infoPtr, wParam);
 
 /*	case HDM_SETFILTERCHANGETIMEOUT: */
 
         case HDM_SETHOTDIVIDER:
-            return HEADER_SetHotDivider(hwnd, wParam, lParam);
+            return HEADER_SetHotDivider(infoPtr, wParam, lParam);
 
 	case HDM_SETIMAGELIST:
-	    return HEADER_SetImageList (hwnd, (HIMAGELIST)lParam);
+	    return HEADER_SetImageList (infoPtr, (HIMAGELIST)lParam);
 
 	case HDM_SETITEMA:
 	case HDM_SETITEMW:
-	    return HEADER_SetItemT (hwnd, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_SETITEMW);
+	    return HEADER_SetItemT (infoPtr, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_SETITEMW);
 
 	case HDM_SETORDERARRAY:
-	    return HEADER_SetOrderArray(hwnd, wParam, lParam);
+	    return HEADER_SetOrderArray(infoPtr, wParam, lParam);
 
 	case HDM_SETUNICODEFORMAT:
-	    return HEADER_SetUnicodeFormat (hwnd, wParam);
+	    return HEADER_SetUnicodeFormat (infoPtr, wParam);
 
         case WM_CREATE:
             return HEADER_Create (hwnd, lParam);
 
         case WM_DESTROY:
-            return HEADER_Destroy (hwnd);
+            return HEADER_Destroy (infoPtr);
 
         case WM_NCDESTROY:
-            return HEADER_NCDestroy (hwnd);
+            return HEADER_NCDestroy (infoPtr);
 
         case WM_ERASEBKGND:
             return 1;
@@ -2083,47 +2040,47 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             return DLGC_WANTTAB | DLGC_WANTARROWS;
 
         case WM_GETFONT:
-            return HEADER_GetFont (hwnd);
+            return HEADER_GetFont (infoPtr);
 
         case WM_LBUTTONDBLCLK:
-            return HEADER_LButtonDblClk (hwnd, lParam);
+            return HEADER_LButtonDblClk (infoPtr, lParam);
 
         case WM_LBUTTONDOWN:
-            return HEADER_LButtonDown (hwnd, lParam);
+            return HEADER_LButtonDown (infoPtr, lParam);
 
         case WM_LBUTTONUP:
-            return HEADER_LButtonUp (hwnd, lParam);
+            return HEADER_LButtonUp (infoPtr, lParam);
 
         case WM_MOUSELEAVE:
-            return HEADER_MouseLeave (hwnd);
+            return HEADER_MouseLeave (infoPtr);
 
         case WM_MOUSEMOVE:
-            return HEADER_MouseMove (hwnd, lParam);
+            return HEADER_MouseMove (infoPtr, lParam);
 
 	case WM_NOTIFYFORMAT:
-            return HEADER_NotifyFormat (hwnd, wParam, lParam);
+            return HEADER_NotifyFormat (infoPtr, wParam, lParam);
 
 	case WM_SIZE:
-	    return HEADER_Size (hwnd);
+	    return HEADER_Size (infoPtr);
 
         case WM_THEMECHANGED:
-            return HEADER_ThemeChanged (hwnd);
+            return HEADER_ThemeChanged (infoPtr);
 
         case WM_PRINTCLIENT:
         case WM_PAINT:
-            return HEADER_Paint (hwnd, wParam);
+            return HEADER_Paint (infoPtr, wParam);
 
         case WM_RBUTTONUP:
-            return HEADER_RButtonUp (hwnd, lParam);
+            return HEADER_RButtonUp (infoPtr, lParam);
 
         case WM_SETCURSOR:
-            return HEADER_SetCursor (hwnd, lParam);
+            return HEADER_SetCursor (infoPtr, lParam);
 
         case WM_SETFONT:
-            return HEADER_SetFont (hwnd, wParam, lParam);
+            return HEADER_SetFont (infoPtr, wParam, lParam);
 
         case WM_SETREDRAW:
-            return HEADER_SetRedraw(hwnd, wParam, lParam);
+            return HEADER_SetRedraw(infoPtr, wParam, lParam);
 
         default:
             if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg))
-- 
1.5.6.5







More information about the wine-patches mailing list