CListCtrl树的遍历 任意子节点个数

UINT GetSelectedTreeCount(CTreeCtrl* tree,HTREEITEM curSel){
	UINT nCount = 0; 
	CList<HTREEITEM> hTreeItemList;
	if (curSel) 
	{ 
		HTREEITEM hItem = curSel;
		hTreeItemList.AddTail(hItem);
		while(!hTreeItemList.IsEmpty()){
			hItem=hTreeItemList.RemoveHead();
			nCount++;
			for(hItem=tree->GetChildItem(hItem);hItem;hItem=tree->GetNextItem(hItem,TVGN_NEXT)){
				hTreeItemList.AddTail(hItem);
			}
		}
		
	}
	return nCount;

}


 

CListCtrl树的遍历 任意子节点个数

你可能感兴趣的:(CListCtrl树的遍历 任意子节点个数)