CListBox::GetItemDataPtr

void* GetItemDataPtr( int nIndex ) const;

Return Value

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

Parameters

nIndex

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

Remarks

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

Example

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

// 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 < pmyListBox->GetCount();i++)
{
   if (pmyListBox->GetItemDataPtr(i) == lpmyPtr)
   {
      pmyListBox->SetItemDataPtr(i, NULL);
   }
}

CListBox OverviewClass MembersHierarchy Chart

See Also   CListBox::AddString, CListBox::GetItemData, CListBox::InsertString, CListBox::SetItemData, LB_GETITEMDATA