CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    96

    How to retrieve items in a multi selection CListView

    IS there a more efficient way to retrieve the items selected other then having to iterate through the entire list and checking if the item has been selected or not like the following:

    Code:
    for (int nItem = 0; nItem <  m_refListCtrl.GetItemCount(); )
    {
         if (m_refListCtrl.GetItemState(nItem, LVIS_SELECTED) == LVIS_SELECTED)
        {
    	// do something
        }	
        ++nItem;
    }

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: How to retrieve items in a multi selection CListView

    GetFirstSelectedItemPosition()
    GetNextSelectedItem();

  3. #3
    Join Date
    Oct 2007
    Posts
    96

    Re: How to retrieve items in a multi selection CListView

    Quote Originally Posted by GCDEF View Post
    GetFirstSelectedItemPosition()
    GetNextSelectedItem();
    Thanks GCDEF. That did the trick. Best Wishes.

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