This topic has not yet been rated - Rate this topic

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;
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.

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

Header: afxwin.h

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.