Freigeben über


CListBox::GetItemDataPtr

Retrieves the application-supplied 32-bit value associated with the specified list-box item as a pointer (void*).

void* GetItemDataPtr(
   int nIndex 
) const;

Parameters

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

Return Value

Retrieves a pointer, or –1 if an error occurs.

Example

LPVOID lpmyPtr = pParentWnd;

// Check all the items in the list box; if an item's
// data pointer is equal to my pointer then reset it to NULL.
for (int i=0; i < m_myListBox.GetCount(); i++)
{
   if (m_myListBox.GetItemDataPtr(i) == lpmyPtr)
   {
      m_myListBox.SetItemDataPtr(i, NULL);
   }
}

Requirements

Header: afxwin.h

See Also

Reference

CListBox Class

Hierarchy Chart

CListBox::AddString

CListBox::GetItemData

CListBox::InsertString

CListBox::SetItemData

LB_GETITEMDATA

Other Resources

CListBox Members