# MFC: Change HTREEITEM's parent.

## Recommended Posts

BeanDog    1065
I'm writing an app in MFC that has a treeview that can drag/drop onto itself using OLE drag operations. Point is, at the end I have a function to implement:
void CMyTreeCtrl::MoveItem(HTREEITEM hToMove, HTREEITEM hNewParent)
{
}

I've looked everywhere in the documentation and all over the web, and I can't find any documentation on how to make this happen. If possible, I want to avoid manually cloning the entire tree under hMove inside of hNewParent and then deleting hMove and its children. How do you move a treeview item in MFC or Win32?

##### Share on other sites
TFS_Waldo    146
The only thing I can tell you is to delete the individual item, then re-insert it, specifying the new parent item.