解决方案 »

  1.   

    通过GetParentItem()和GetItemText()应该就可以了啊
      

  2.   

    GetParentItem()和GetItemText()
    0k
      

  3.   

    写程序时,遇到过这样的问题,自己想的方法,拿出来分享://得到当前选中结点的文件路径
    //参数hCurrItem: 当前选中结点
    CString CHostDirectoryDlg::GetFilePath(HTREEITEM hCurrItem)
    {
    HTREEITEM hParentItem; 
    CString strFilePath;
    do
    {
    hParentItem = m_TreeCtrlDirectory.GetParentItem(hCurrItem);
    CString strTemp = m_TreeCtrlDirectory.GetItemText(hCurrItem);
    strFilePath.Insert(0, strTemp); //把当前结点的字符加到前面
    strFilePath.Insert(0, "\\");
    hCurrItem = hParentItem;
    }while(hParentItem != m_TreeCtrlDirectory.GetRootItem());
    strFilePath = strFilePath.Right(strFilePath.GetLength() - 1);
    return strFilePath;
    }