The TreeView_GetRootNode() function returns the ID of the first root-level node in a tree view field.
TreeView_GetRootNode(tree_view_field)
• tree_view_field – The tree view field containing the specified node.
A long integer containing the node ID of the first root-level node. If the tree has no nodes, TV_NODEINVALID is returned.