If you want to iterate over your root items, you would call GetTreeItem in a loop like this:
for (err = GetTreeItem(panel, ctrl, VAL_SIBLING, 0, VAL_FIRST, VAL_NEXT_PLUS_SELF, 0, &index);
err >0 && index != -1;
err = GetTreeItem(panel, ctrl, VAL_SIBLING, 0, index, VAL_NEXT, 0, &index)) { ... }
Take a look at GetTreeItem's function panel for names and detailed descriptions of each parameter. In this example, the relation parameter (VAL_SIBLING) indicates that you are looking only for items at the same level in the tree. The relative index (0) is the index whose siblings you are searching for. Begin index is the tree item that you will begin searching from. When you first call this function, you pass VAL_FIRST to start with the first matching item, then subsequent calls pass index to continue the search from the previously returned index. The direction parameter is VAL_NEXT_PLUS_SELF if the begin index needs to be processed, or it is VAL_NEXT if the passed begin index has already been processed and so shouldn't be returned again.
Hope this helps.
Mert A.
National Instruments