Rediger

Del via


TVM_DELETEITEM message

Removes an item and all its children from a tree-view control. You can send this message explicitly or by using the TreeView_DeleteItem macro.

Parameters

wParam

Must be zero.

lParam

HTREEITEM handle to the item to delete. If lParam is set to TVI_ROOT or to NULL, all items are deleted. You can also use the TreeView_DeleteAllItems macro to delete all items.

Return value

Returns TRUE if successful, or FALSE otherwise.

Remarks

It is not safe to delete items in response to a notification such as TVN_SELCHANGING.

Once an item is deleted, its handle is invalid and cannot be used.

The parent window receives a TVN_DELETEITEM notification code when each item is removed.

If the item label is being edited, the edit operation is canceled and the parent window receives the TVN_ENDLABELEDIT notification code.

If you delete all items in a tree-view control that has the TVS_NOSCROLL style, items subsequently added may not display properly. For more information, see TreeView_DeleteAllItems.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Commctrl.h