Export (0) Print
Expand All

CComboBox::GetItemDataPtr 

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


void* GetItemDataPtr(
   int nIndex 
) const;

Parameters

nIndex

Contains the zero-based index of an item in the combo box's list box.

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

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

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

Community Additions

ADD
Show:
© 2014 Microsoft