LISTBOX_FindStringPos fix

Rein Klazes rklazes at xs4all.nl
Tue Apr 8 09:15:44 CDT 2003


Hi,

This fixes one problem encoutered with MetaStock. This program dies
handling a WM_COMPAREITEM message when adding strings to a listbox.
Exhanging in the message the item in the listbox and the item to be
added fixes that. Spotted that easily by comparing SPY++ logs under
win2K and under wine, great.

For the changelog:
	controls/	: listbox.c
	Compare  the two items in LISTBOX_FindStringPos()
	in the same order as in Windows.

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/controls/listbox.c	2003-03-15 07:54:11.000000000 +0100
+++ mywine/controls/listbox.c	2003-04-08 16:11:49.000000000 +0200
@@ -810,7 +810,7 @@
     {
         index = (min + max) / 2;
         if (HAS_STRINGS(descr))
-            res = lstrcmpiW( descr->items[index].str, str );
+            res = lstrcmpiW( str, descr->items[index].str);
         else
         {
             COMPAREITEMSTRUCT cis;
@@ -819,15 +819,17 @@
             cis.CtlType    = ODT_LISTBOX;
             cis.CtlID      = id;
             cis.hwndItem   = hwnd;
-            cis.itemID1    = index;
-            cis.itemData1  = descr->items[index].data;
-            cis.itemID2    = -1;
-            cis.itemData2  = (DWORD)str;
+            /* note that some application (MetaStock) expects the second item
+             * to be in the listbox */
+            cis.itemID1    = -1;
+            cis.itemData1  = (DWORD)str;
+            cis.itemID2    = index;
+            cis.itemData2  = descr->items[index].data;
             cis.dwLocaleId = descr->locale;
             res = SendMessageW( descr->owner, WM_COMPAREITEM, id, (LPARAM)&cis );
         }
         if (!res) return index;
-        if (res > 0) max = index;
+        if (res < 0) max = index;
         else min = index + 1;
     }
     return exact ? -1 : max;


More information about the wine-patches mailing list