How can I select a list view item?

I tried with lvm_setitemstate but it doesn't work. Maybe my code is wrong
Posted on 2003-06-04 13:06:41 by greenant
Did you set the statemask to LVIS_SELECTED as well as the state flag. Both must be set in order to change the state of the item.
Posted on 2003-06-04 13:16:27 by donkey
This is my code


mov lvi.imask, LVIF_STATE
mov lvi.iItem, 2
mov lvi.iSubItem, 0
mov lvi.state, LVIS_SELECTED
mov lvi.stateMask, LVIS_SELECTED

invoke SendMessage, hList, LVM_SETITEMSTATE, 2, addr lvi

it doesn't work
Posted on 2003-06-04 13:36:57 by greenant
That should work, have you done a LVM_GETNEXTITEM to see if it was selected ? Also be sure to redraw your control to show the selected state.
Posted on 2003-06-04 14:10:27 by donkey
Now it works. I found the mistake: I selected the item before filling the listview
Posted on 2003-06-05 11:32:59 by greenant