CComboBox::GetItemDataPtr
检索该由应用程序提供的32位值与指定的组合框项作为指针(void*)。
void* GetItemDataPtr(
int nIndex
) const;
参数
- nIndex
在组合框上包含项的从零开始的索引列表框。
返回值
如果发生错误,检索指针或– 1。
示例
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