Finding item row index in ListView by text and by column
I'm using the following code to retrieve the index of a row that contains certain text in the second column (开发者_开发问答of which it has 3, an index one, and two that contain other text).
LVFINDINFO inf={0};
inf.flags=LVFI_PARCIAL|LVFI_STRING;
inf.psz="textToFind";
std::cout<<ListView_FindItem(mywinHandle, -1, (LPARAM)&inf);
However, this will only return -1 as it will search in the first column (the index one -- on 15 input, will return 15, etc.). I've tried understanding the way to use the lParam member to search in other specific column (if that's even possible), but couldn't even when I added as a lParam a LVITEM with the correct Item member. I just couldn't quite find the way here http://msdn.microsoft.com/en-us/library/bb774745%28v=vs.85%29.aspx
Thanks for any help.
You can't search in the sub-columns. You can only search in the primary column.
The lParam
value specifies which row to start searching from. You are mistaken in thinking that it allows you to specify which column to search.
精彩评论