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);

posted @ 2011-07-06 19:38  ahuo  阅读(5237)  评论(0编辑  收藏  举报