如何得到树中结点的全路径

可用以下代码实现

HTREEITEM CurrentNode = m_tree.GetSelectedItem();//得到当前子树句柄

CString Temp;
CString FullPath = "";
while(CurrentNode != m_hRoot)
{
Temp = m_tree.GetItemText(CurrentNode);
if(Temp.Right(1) != "\\")
{
Temp += "\\";
}
FullPath = Temp + FullPath;
CurrentNode = m_tree.GetParentItem(CurrentNode);
}

FullPath中存放就是全路径了

你可能感兴趣的:(路径)