CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: CListControl

  1. #1
    Join Date
    May 1999
    Posts
    23

    CListControl

    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


  2. #2
    Join Date
    May 1999
    Location
    Seattle, WA USA
    Posts
    423

    Re: CListControl

    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


  3. #3
    Join Date
    May 1999
    Posts
    23

    Re: CListControl

    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


  4. #4
    Join Date
    May 1999
    Location
    Seattle, WA USA
    Posts
    423

    Re: CListControl

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured