如何遍历CTreeCtrl树 [英] How can I traverse CTreeCtrl tree

查看:253
本文介绍了如何遍历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

正如他们说的那样,这是正确的来源:
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 called CTreeCtrl::GetNextSiblingItem and CTreeCtrl::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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆