CListBox::DeleteItem

virtualvoidDeleteItem(LPDELETEITEMSTRUCTlpDeleteItemStruct**);**

Parameters

lpDeleteItemStruct

A long pointer to a Windows DELETEITEMSTRUCT structure that contains information about the deleted item.

Remarks

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

See CWnd::OnDeleteItem for a description of the DELETEITEMSTRUCT structure.

Example

// CMyListBox is my owner-drawn list box derived from CListBox. This
// example simply frees the item's text. The list 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 CMyListBox::DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct)
{
   ASSERT(lpDeleteItemStruct->CtlType == ODT_LISTBOX);
   LPVOID lpszText = (LPVOID) lpDeleteItemStruct->itemData;
   ASSERT(lpszText != NULL);

   free(lpszText);
}

CListBox OverviewClass MembersHierarchy Chart

See Also   CListBox::CompareItem, CWnd::OnDeleteItem, CListBox::DrawItem, CListBox::MeasureItem,