如何遍历CTreeCtrl树 [英] How can I traverse CTreeCtrl tree
本文介绍了如何遍历CTreeCtrl树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何遍历 CTreecntrl CTreeCtrl 树并将其保存在结构类型向量中?
How can I traverse a CTreecntrl CTreeCtrl tree and save it in a structure type vector?
推荐答案
5分钟的研究得出了以下结论:
http://www.codeguru.com/forum/archive/index.php/t- 359096.html
而这个:
http://www.ms-news.net/f3291/traversing-ctreectrl-structure- 2705009.html
正如他们说的那样,这是正确的来源:
http://msdn.microsoft.com/en-us/library/8bkz91b4(v=vs. 80).aspx
但是还有更多:我刚刚发现CTreeCtrl是称为CTreeCtrl::GetNextSiblingItem
和CTreeCtrl::GetNextItem
的方法,这意味着您可以进行深度优先搜索或宽度优先搜索.
玩得开心!
干杯,
曼弗雷德(Manfred)
5 minutes research brought forth this:
http://www.codeguru.com/forum/archive/index.php/t-359096.html
and this:
http://www.ms-news.net/f3291/traversing-ctreectrl-structure-2705009.html
This one is right from the source as they say:
http://msdn.microsoft.com/en-us/library/8bkz91b4(v=vs.80).aspx
But wait there''s more: I just found out that CTreeCtrl as a method calledCTreeCtrl::GetNextSiblingItem
andCTreeCtrl::GetNextItem
which means you can do a depth first search or a breadth first search.
Have fun!
Cheers,
Manfred
HTREEITEM hItem = GetRootItem();
while (NULL != hItem)
{
//TODO: Do what you want to the hItem here
hItem = GetNextSiblingItem(hItem);
}
这篇关于如何遍历CTreeCtrl树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文