我这样遍历树为什么不对
我的界面上有一个树控件,一个按纽,两个EDIT控件,我想实现的是把EDIT 中的值和树中的节点进行比较如果有相同的就把另一个EDIT中值赋为1,但是现在我在EDIT中输入了一个与树中节点相同的,但是在另一个EDIT中并没有赋值,以下是遍历树代码
void CList_treeDlg::OnButton3()
{
// TODO: Add your control notification handler code here
CString treetext=m_edit1;
UpdateData(true);
HTREEITEM hItem=m_tree.GetRootItem();
TravelChild(hItem);
}
void CList_treeDlg::TravelChild(HTREEITEM Item)
{
HTREEITEM hChildItem,hBrotherItem;
//查找子节点,没有就结束
hChildItem=m_tree.GetChildItem(Item);
CString hh=m_edit1;
UpdateData(true);
if (m_tree.GetRootItem()==NULL)
{return;}
else
{
if (hChildItem!=NULL)
{
CString kk=m_tree.GetItemText(Item);
if (kk==hh)
{
m_edit=1;
UpdateData(false);
}
TravelChild(hChildItem);
//处理子节点的兄弟节点和其子节点
hBrotherItem = m_tree.GetNextSiblingItem(hChildItem);
if (hBrotherItem!=NULL)
{
CString kk1=m_tree.GetItemText(hBrotherItem);
if(kk1 == hh)
{
m_edit=1;
UpdateData(false);
}
TravelChild(hBrotherItem);
hBrotherItem=m_tree.GetNextSiblingItem(hBrotherItem);
}
}
}
}
我看不出来错再那?