Mike McCormack : comctl32: Return the correct value for CB_GETLBTEXTLEN.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 6 06:28:18 CDT 2006


Module: wine
Branch: master
Commit: 1207e84af50da8525c802cf70593aa2db5e31f45
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1207e84af50da8525c802cf70593aa2db5e31f45

Author: Mike McCormack <mike at codeweavers.com>
Date:   Fri Oct  6 17:42:22 2006 +0900

comctl32: Return the correct value for CB_GETLBTEXTLEN.

---

 dlls/comctl32/comboex.c |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index 1f29024..00c5fc3 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -501,6 +501,32 @@ static inline BOOL COMBOEX_HasEdit(COMBO
 
 /* ***  CBEM_xxx message support  *** */
 
+static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, int n, LPWSTR buf)
+{
+    CBE_ITEMDATA *item;
+    LPCWSTR str;
+
+    item = COMBOEX_FindItem(infoPtr, n);
+    if (!item)
+        return 0;
+
+    str = COMBOEX_GetText(infoPtr, item);
+
+    if (infoPtr->unicode)
+    {
+        if (buf)
+            lstrcpyW(buf, str);
+        return lstrlenW(str);
+    }
+    else
+    {
+        UINT r;
+        r = WideCharToMultiByte(CP_ACP, 0, str, -1, (LPSTR)buf, 0x40000000, NULL, NULL);
+        if (r) r--;
+        return r;
+    }
+}
+
 
 static INT COMBOEX_DeleteItem (COMBOEX_INFO *infoPtr, INT index)
 {
@@ -2193,11 +2219,15 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg
 	case WM_GETTEXT:
             return SendMessageW(infoPtr->hwndEdit, uMsg, wParam, lParam);
 
+	case CB_GETLBTEXT:
+            return COMBOEX_GetListboxText(infoPtr, wParam, (LPWSTR)lParam);
+
+	case CB_GETLBTEXTLEN:
+            return COMBOEX_GetListboxText(infoPtr, wParam, NULL);
+
 /*   Combo messages we are not sure if we need to process or just forward */
 	case CB_GETDROPPEDCONTROLRECT:
 	case CB_GETITEMHEIGHT:
-	case CB_GETLBTEXT:
-	case CB_GETLBTEXTLEN:
 	case CB_GETEXTENDEDUI:
 	case CB_LIMITTEXT:
 	case CB_RESETCONTENT:




More information about the wine-cvs mailing list