共用方式為


CListBox::GetSelItems

在多重選取清單方塊中指定所選取項目的項目編號的整數陣列填滿緩衝區。

int GetSelItems(
   int nMaxItems,
   LPINT rgIndex 
) const;

參數

  • nMaxItems
    指定項目數目要放在緩衝區中所選取項目的最大數目。

  • rgIndex
    指定指標指向足夠大的緩衝區。 nMaxItems指定的整數數目。

傳回值

在緩衝區中放置項目的實際數目。 如果清單方塊是單一選取清單方塊中,傳回值為 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);

需求

標題: afxwin.h

請參閱

參考

CListBox 類別

階層架構圖

LB_GETSELITEMS

CListBox::GetSelCount