comctl32: Use a modified version of STATUSBAR_GetTextLength for WM_GETTEXTLENGTH

André Hentschel nerv at dawncrow.de
Wed Dec 28 19:42:47 CST 2011


SB_GETTEXTLENGTH returns two words merged into LRESULT, WM_GETTEXTLENGTH doesn't
should help http://bugs.winehq.org/show_bug.cgi?id=25116
---
 dlls/comctl32/status.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c
index 43b65aa..b57c80a 100644
--- a/dlls/comctl32/status.c
+++ b/dlls/comctl32/status.c
@@ -1033,6 +1033,30 @@ STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf)
 }
 
 
+static LRESULT STATUSBAR_WMGetTextLength (STATUS_INFO *infoPtr, INT nPart)
+{
+    STATUSWINDOWPART *part;
+    DWORD result;
+
+    TRACE("part %d\n", nPart);
+
+    /* MSDN says: "simple parts use index of 0", so this check is ok. */
+    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
+
+    if (infoPtr->simple)
+        part = &infoPtr->part0;
+    else
+        part = &infoPtr->parts[nPart];
+
+    if (part->text)
+        result = strlenW(part->text);
+    else
+        result = 0;
+
+    return result;
+}
+
+
 static BOOL
 STATUSBAR_WMNCHitTest (const STATUS_INFO *infoPtr, INT x, INT y)
 {
@@ -1284,7 +1308,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             return STATUSBAR_WMGetText (infoPtr, (INT)wParam, (LPWSTR)lParam);
 
 	case WM_GETTEXTLENGTH:
-	    return STATUSBAR_GetTextLength (infoPtr, 0);
+	    return STATUSBAR_WMGetTextLength (infoPtr, 0);
 
 	case WM_LBUTTONDBLCLK:
             return STATUSBAR_SendMouseNotify(infoPtr, NM_DBLCLK, msg, wParam, lParam);
-- 

Best Regards, André Hentschel
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Nachrichtenteil als Anhang
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20111229/cbf93998/attachment.ksh>


More information about the wine-patches mailing list