CComboBox::SetItemDataPtr
This documentation is archived and is not being maintained.

CComboBox::SetItemDataPtr 

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


int SetItemDataPtr( 
   int nIndex, 
   void* pData 
);

Parameters

nIndex

Contains a zero-based index to the item.

pData

Contains the pointer to associate with the item.

CB_ERR if an error occurs.

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

// The pointer to my combo box.
extern CComboBox* pmyComboBox;

// Set the data pointer of each item to be NULL.
for (int i=0;i < pmyComboBox->GetCount();i++)
{
   pmyComboBox->SetItemDataPtr(i, NULL);
}
Show:
© 2016 Microsoft