I am doing a win32 application using List view control,I used extended style LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT.My application demands for force selection of row(ie,Searching for an item,if it found select that item via program)I tryed with both LVM_SETITEMSTATEas well as ListView_SetItemState,But iam not getting as selected
First code using macro
Code:
itemNo=Search(lvItem.pszText)//Search the item and returned the item index,working fine
MessageBox()//Item already exist
ListView_SetItemState(hWnd, itemNo, LVIS_SELECTED | LVIS_FOCUSED, 
0x000f); //fails
using LVM_SETITEMSTATE

Code:
itemNo=Search(lvItem.pszText)//Search the item and returned the item index,working fine
MessageBox()//Item already exist
lvItem.iItem=itemNo;
lvItem.mask=LVIF_STATE;
lvItem.state=LVIS_SELECTED;
lvItem.stateMask=0x00f;
SendMessage(hWnd,LVM_SETITEMSTATE,itemNo,(LPARAM)&lvItem);