Compartilhar via


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.

Return Value

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

Example

LPVOID    lpmyPtr = m_pComboBox->GetItemDataPtr(5);

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

Requirements

Header: afxwin.h

See Also

Reference

CComboBox Class

Hierarchy Chart

CComboBox::SetItemDataPtr

CComboBox::GetItemData

CComboBox::SetItemData

CB_GETITEMDATA

Other Resources

CComboBox Members