From a5c970dea9cbe50a124443556c9bfe11d90ab23b Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 10 Jun 2009 22:56:44 +0400 Subject: [PATCH] comctl32/listview: Make item width calculation not rely on column order for LV_VIEW_DETAILS. --- dlls/comctl32/listview.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 55519dd4fec..c210bf53843 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -2505,11 +2505,15 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr) nItemWidth = infoPtr->iconSpacing.cx; else if (infoPtr->uView == LV_VIEW_DETAILS) { - RECT rcHeader; - if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0) { - LISTVIEW_GetHeaderRect(infoPtr, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, &rcHeader); + RECT rcHeader; + INT index; + + index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, + DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0); + + LISTVIEW_GetHeaderRect(infoPtr, index, &rcHeader); nItemWidth = rcHeader.right; } }