mfc TreeCtrl 遍历


void   ExpandTreeItems(const   CTreeCtrl&   tree,HTREEITEM   hItem)
{
 AfxMessageBox( tree.GetItemText(hItem));
 
 HTREEITEM   hChildItem = tree.GetChildItem(hItem);
 if ( NULL != hChildItem)
  ExpandTreeItems(tree,hChildItem);


 HTREEITEM hSib = tree.GetNextSiblingItem(hItem);
 if (hSib != NULL)
  ExpandTreeItems(tree,hSib);
}

 HTREEITEM   hItem=m_tree.GetRootItem();
 ExpandTreeItems(m_tree,hItem);

你可能感兴趣的:(tree)