Hello! Please tell me how to iterate over or delete everything under the elements of the selected tree view element. The code for checking the markedness is:

case WM_NOTIFY: { if (((LPNMHDR)lParam)->code == NM_DBLCLK) { TV_ITEM tvi; char Text[256] = ""; memset(&tvi, 0, sizeof(tvi)); Selected = (HTREEITEM)SendMessage(treeView, TVM_GETNEXTITEM, TVGN_CARET, (LPARAM)Selected); if (Selected == NULL) { MessageBox(window, "No Items in TreeView", "Error", MB_OK | MB_ICONINFORMATION); break; } TreeView_EnsureVisible(treeView, Selected); SendMessage(treeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)Selected); tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.pszText = Text; tvi.cchTextMax = 256; tvi.hItem = Selected; if (SendMessage(treeView, TVM_GETITEM, TVGN_CARET, (LPARAM)&tvi)) { } } } break; 
  • HTREEITEM item; SendMessage(_window, TVM_DELETEITEM, 0, (LPARAM)item); Do you need to delete at all? It should unfold / be coordinated. And I can once again recommend storing the items not in lParam but separately, so it is more convenient (for me) - J. Doe
  • one
    Find under elements - TreeView_GetParent , TreeView_GetChild , or store them. - J. Doe
  • @ J.Doe I store them in lParam because this is the only way I know how to get information about item - helldrg
  • So it turns out the search will look like this: we find TreeView_GetChild delete it, again we find again delete and if nothing else finds then we all have already deleted? - helldrg
  • one
    Well, if it already works or not, it should work), and the storage is simple - the container tree (the structure with the vector will be simplified) its pointer to lParam, when there is a message processing there will be a whole list of its children, it will be necessary to delete all the treeview elements ( all vh) and clear the vector of children (v.clear ()), if it is rough. - J. Doe

0