You know, I keep answering your questions not having actually use Windows API for at least a decade, and never appreciating such language as C++. And I simply never ever spent a minute (should I say "wasted" :-)) on manipulating of tree views in C++ and raw Windows API. Nevertheless…
Windows API tells us that, to insert a tree view node, you have to send message
TVM_INSERTITEM
with
TVINSERTSTRUCT
as
LPARAM
. In other words, you give Windows API a pointer:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb773733%28v=vs.85%29.aspx[
^],
https://msdn.microsoft.com/en-us/library/windows/desktop/bb773452%28v=vs.85%29.aspx[
^].
Now imagine that you do the same, but not for a brand-new structure representing a tree node, but representing already created tree node with all the sub-tree of this node, just detached from the tree view, the some or another one. Isn't that apparent that it will attach the whole sub-tree? This is the same as in case of tree as a data structure.
I'm also coming from one simple "practical" thought: if Windows API required recursive re-creation of sub-tree just for moving one from one parent to another,
it would be extremely stupid API. I would hardly believe such API could ever survive the market.
I hope that from this point you can continue looking through Windows API, the way I started it, and finalize this solution… :-)
—SA