Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
BOOLDeleteItem(HTREEITEMhItem );
Return Value
Nonzero if successful; otherwise 0.
Parameters
hItem
Handle of the tree item to be deleted. If hitem has the TVI_ROOT value, all items are deleted from the tree view control.
Remarks
Call this function to delete an item from the tree view control.
Example
// Gain a pointer to our tree control
CTreeCtrl* pCtrl = (CTreeCtrl*) GetDlgItem(IDC_TREE1);
ASSERT(pCtrl != NULL);
// Look at all of the root-level items
HTREEITEM hCurrent = pCtrl->GetNextItem(TVI_ROOT, TVGN_NEXT);
while (hCurrent != NULL)
{
// Get the text for the item. Notice we use TVIF_TEXT because
// we want to retrieve only the text, but also specify TVIF_HANDLE
// because we're getting the item by its handle.
TVITEM item;
TCHAR szText[1024];
item.hItem = hCurrent;
item.mask = TVIF_TEXT | TVIF_HANDLE;
item.pszText = szText;
item.cchTextMax = 1024;
BOOL bWorked = pCtrl->GetItem(&item);
// Try to get the next item
hCurrent = pCtrl->GetNextItem(hCurrent, TVGN_NEXT);
// If we successfuly retrieved an item, and the item's text
// contains a lowercase letter 'e', delete the item.
if (bWorked && _tcschr(item.pszText, 'e'))
pCtrl->DeleteItem(item.hItem);
}