CComboBox::DeleteItem

virtual void DeleteItem( LPDELETEITEMSTRUCT lpDeleteItemStruct );

Parameters

lpDeleteItemStruct   A long pointer to a Windows DELETEITEMSTRUCT structure that contains information about the deleted item. See CWnd::OnDeleteItem for a description of this structure.

Remarks

Called by the framework when the user deletes an item from an owner-draw CComboBox object or destroys the combo box. The default implementation of this function does nothing. Override this function to redraw the combo box as needed.

Example

// CMyComboBox is my owner-drawn combo box derived from CComboBox. This 
// example simply frees the item's text. The combo box control was 
// created with the following code:
//   pmyListBox->Create(
//      WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|
//      LBS_SORT|LBS_MULTIPLESEL|LBS_OWNERDRAWVARIABLE,
//      myRect, pParentWnd, 1);
//
void CMyComboBox::DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct) 
{
   ASSERT(lpDeleteItemStruct->CtlType == ODT_COMBOBOX);
   LPVOID lpszText = (LPVOID) lpDeleteItemStruct->itemData;
   ASSERT(lpszText != NULL);

   free(lpszText);
}

CComboBox OverviewClass MembersHierarchy Chart

See Also   CComboBox::CompareItem, CComboBox::DrawItem, CComboBox::MeasureItem, WM_DELETEITEM