Click to See Complete Forum and Search --> : CListControl
veesub
May 18th, 1999, 07:43 AM
Hi all,
how can i get the LV_ITEM structure of an item inserted in the list control. The GetItem() function didn't work for me. It's returning unexpected values. How can I mention which item to be retrieved.please inform if anyone find information about this
thanks in advance
bye
chiuyan
May 18th, 1999, 09:38 AM
The GetItem function takes a pointer to a LV_ITEM that describes the Item you want, and then fills in the pointer with the corresponding item's info.
So, I think you would have to do something like.
LV_ITEM Item;
Item.mask = LVIF_TEXT; // or whatever your mask is
Item.iItem = 10;
m_List.GetItem (&Item);
--michael
veesub
May 19th, 1999, 12:39 AM
Hello,
I tried this method and it didn't work. It's returning whatever value I initialized to the iImage item even after calling GetItem(&item) with appropriate index and mask fields. Can you please suggest some idea how to retrieve the iImage item of the selected item in the listcontrol.
bye
chiuyan
May 19th, 1999, 10:10 AM
I would expect something like this to work.
int iImage = 0;
int iItem = m_List.GetNextItem (-1, LVIS_SELECTED);
if (iItem != -1)
{
LV_ITEM Item;
memset (&Item, 0, sizeof LV_ITEM);
Item.iItem = iItem;
m_List.GetItem (&Item);
if (Item.mask & LVIF_IMAGE)
iImage = Item.iImage;
}
--michael
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.