Поделиться через


CListBox::SetItemDataPtr

Sets the 32-bit value associated with the specified item in a list box to be the specified pointer (void*).

int SetItemDataPtr(
   int nIndex,
   void* pData 
);

Параметры

  • nIndex
    Specifies the zero-based index of the item.

  • pData
    Specifies the pointer to be associated with the item.

Возвращаемое значение

LB_ERR if an error occurs.

Заметки

This pointer remains valid for the life of the list box, even though the item's relative position within the list box might change as items are added or removed. Hence, the item's index within the box can change, but the pointer remains reliable.

Пример

// Set the data pointer of each item to be NULL.
for (int i=0;i < m_myListBox.GetCount();i++)
{
   m_myListBox.SetItemDataPtr(i, NULL);
}

Требования

Header: afxwin.h

См. также

Основные понятия

CListBox Class

CListBox Members

Hierarchy Chart

CListBox::SetItemData

CListBox::GetItemData

CListBox::GetItemDataPtr

LB_SETITEMDATA