CListBox::GetSelItems

Fills a buffer with an array of integers that specifies the item numbers of selected items in a multiple-selection list box.

int GetSelItems(
   int nMaxItems,
   LPINT rgIndex 
) const;

nMaxItems

Specifies the maximum number of selected items whose item numbers are to be placed in the buffer.

rgIndex

Specifies a pointer to a buffer large enough for the number of integers specified by nMaxItems.

The actual number of items placed in the buffer. If the list box is a single-selection list box, the return value is LB_ERR.


// Get the indexes of all the selected items.
int nCount = m_myODListBox.GetSelCount();
CArray<int,int> aryListBoxSel;

aryListBoxSel.SetSize(nCount);
m_myODListBox.GetSelItems(nCount, aryListBoxSel.GetData()); 

// Dump the selection array.
AFXDUMP(aryListBoxSel);


Header: afxwin.h

Community Additions

ADD
Show: