comctl32/listview: LVM_SETITEM is unsupported on LVS_OWNERDATA.

This commit is contained in:
Nikolay Sivov 2009-04-21 05:26:10 -04:00 committed by Alexandre Julliard
parent 5a6f956187
commit 949e9043b9
2 changed files with 22 additions and 3 deletions

View File

@ -10010,10 +10010,11 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* case LVM_SETINSERTMARKCOLOR: */
case LVM_SETITEMA:
return LISTVIEW_SetItemT(infoPtr, (LPLVITEMW)lParam, FALSE);
case LVM_SETITEMW:
return LISTVIEW_SetItemT(infoPtr, (LPLVITEMW)lParam, TRUE);
{
if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
return LISTVIEW_SetItemT(infoPtr, (LPLVITEMW)lParam, (uMsg == LVM_SETITEMW));
}
case LVM_SETITEMCOUNT:
return LISTVIEW_SetItemCount(infoPtr, (INT)wParam, (DWORD)lParam);

View File

@ -1651,6 +1651,24 @@ static void test_ownerdata(void)
expect(TRUE, res);
res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
expect(1, res);
res = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
expect(1, res);
DestroyWindow(hwnd);
/* LVM_SETITEM is unsupported on LVS_OWNERDATA */
hwnd = create_listview_control(LVS_OWNERDATA);
ok(hwnd != NULL, "failed to create a listview window\n");
res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 1, 0);
ok(res != 0, "Expected LVM_SETITEMCOUNT to succeed\n");
res = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
expect(1, res);
memset(&item, 0, sizeof(item));
item.mask = LVIF_STATE;
item.iItem = 0;
item.stateMask = LVIS_SELECTED;
item.state = LVIS_SELECTED;
res = SendMessageA(hwnd, LVM_SETITEM, 0, (LPARAM)&item);
expect(FALSE, res);
DestroyWindow(hwnd);
}