Freigeben über


CListBox::GetSelItems

intGetSelItems(intnMaxItems**,LPINTrgIndex)const;**

Return Value

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.

Parameters

nMaxItems

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

rgIndex

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

Remarks

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

Example

// The pointer to my list box.
extern CListBox* pmyListBox;

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

aryListBoxSel.SetSize(nCount);
pmyListBox->GetSelItems(nCount, aryListBoxSel.GetData());

// Dump the selection array.
#ifdef _DEBUG
   afxDump << aryListBoxSel;
#endif

CListBox OverviewClass MembersHierarchy Chart

See Also