TreeView_DeleteAllItems macro (commctrl.h)
Deletes all items from a tree-view control.
void TreeView_DeleteAllItems( hwnd );
Handle to the tree-view control.
Once an item is deleted from a tree-view control, its HTREEITEM 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 the window style for a tree-view control contains TVS_NOSCROLL and all items are deleted, new items are not displayed until the window styles are reset. The following code shows one way to ensure that items are always displayed.
DWORD styles = GetWindowLong(hwnd, GWL_STYLE); TreeView_DeleteAllItems(hwnd); SetWindowLong(hwnd, GWL_STYLE, styles);
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|