Compare the two items in LISTBOX_FindStringPos() in the same order as

in Windows.
This commit is contained in:
Rein Klazes 2003-04-08 19:41:52 +00:00 committed by Alexandre Julliard
parent 5803dc3bcf
commit 26b2e89812
1 changed files with 8 additions and 6 deletions

View File

@ -810,7 +810,7 @@ static INT LISTBOX_FindStringPos( HWND hwnd, LB_DESCR *descr, LPCWSTR str,
{ {
index = (min + max) / 2; index = (min + max) / 2;
if (HAS_STRINGS(descr)) if (HAS_STRINGS(descr))
res = lstrcmpiW( descr->items[index].str, str ); res = lstrcmpiW( str, descr->items[index].str);
else else
{ {
COMPAREITEMSTRUCT cis; COMPAREITEMSTRUCT cis;
@ -819,15 +819,17 @@ static INT LISTBOX_FindStringPos( HWND hwnd, LB_DESCR *descr, LPCWSTR str,
cis.CtlType = ODT_LISTBOX; cis.CtlType = ODT_LISTBOX;
cis.CtlID = id; cis.CtlID = id;
cis.hwndItem = hwnd; cis.hwndItem = hwnd;
cis.itemID1 = index; /* note that some application (MetaStock) expects the second item
cis.itemData1 = descr->items[index].data; * to be in the listbox */
cis.itemID2 = -1; cis.itemID1 = -1;
cis.itemData2 = (DWORD)str; cis.itemData1 = (DWORD)str;
cis.itemID2 = index;
cis.itemData2 = descr->items[index].data;
cis.dwLocaleId = descr->locale; cis.dwLocaleId = descr->locale;
res = SendMessageW( descr->owner, WM_COMPAREITEM, id, (LPARAM)&cis ); res = SendMessageW( descr->owner, WM_COMPAREITEM, id, (LPARAM)&cis );
} }
if (!res) return index; if (!res) return index;
if (res > 0) max = index; if (res < 0) max = index;
else min = index + 1; else min = index + 1;
} }
return exact ? -1 : max; return exact ? -1 : max;