다음을 통해 공유


CListBox::GetItemData

Retrieves the application-supplied doubleword value associated with the specified list-box item.

DWORD_PTR GetItemData(
   int nIndex 
) const;

Parameters

  • nIndex
    Specifies the zero-based index of the item in the list box.

Return Value

The 32-bit value associated with the item, or LB_ERR if an error occurs.

Remarks

The doubleword value was the dwItemData parameter of a SetItemData call.

Example

// If any item's data is equal to zero then reset it to -1.
for (int i=0; i < m_myListBox.GetCount(); i++)
{
   if (m_myListBox.GetItemData(i) == 0)
   {
      m_myListBox.SetItemData(i, (DWORD) -1);
   }
}

Requirements

Header: afxwin.h

See Also

Concepts

CListBox Class

CListBox Members

Hierarchy Chart

CListBox::AddString

CListBox::GetItemDataPtr

CListBox::SetItemDataPtr

CListBox::InsertString

CListBox::SetItemData

LB_GETITEMDATA