Export (0) Print
Expand All

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.

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

// 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);
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft