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;

nIndex

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

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

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

Header: afxwin.h

Show:
© 2014 Microsoft