CString str = "Sam"; // 要查找的字符串
HTREEITEM hRoot = m_tc.GetRootItem();
HTREEITEM hTemp;
while (hRoot != NULL)
{
if (m_tc.ItemHasChildren(hRoot))
{
hTemp = m_tc.GetNextItem(hRoot, TVGN_CHILD);
while(hTemp != NULL)
{
hTemp = m_tc.GetNextItem(hTemp, TVGN_NEXT);
CString &str = m_tc.GetItemText(hTemp);
if (! str.Find("Sam")) // 如果找到,就把他MsgBox出来
{
MessageBox(str);
}
}
}
hRoot = m_tc.GetNextItem(hRoot, TVGN_NEXT);
}
发表于 @ 2007年02月12日 11:55:00|评论(loading...)|编辑