1.取得或设定项目的信息.
BOOL CTreeCtrl::GetItem(TV_ITEM* pItem);
BOOL CTreeCtrl::SetItem(TV_ITEM* pItem);
BOOL CTreeCtrl::SetItem(HTREEITEM hItem,UINTnMask,LPCTSTR lpszItem,int Image,int nSelectedImage,UINT nState,UINT nStateMask,LPARAME lParam);
2.取得与设定项目的状态
UINT CTreeCtrl::GetItemState(HTREEITEM hItem,UINT sStateMask)const;
BOOL CTree Ctrl::SetItemState(HTREEITEM hItem,UINT nState,UINT nStateMask);
3.取得与设定项目的图形
BOOL CTreeCtrl::GetItemImage(HTREEITEM hItem,int& nImage,int& nSelectedImage)const;
BOOL CTreeCtrl::SetItemImage(HTREEITEM hItem,int nImage,int nSelectedImage);
4. 取得与设定项目的文本
CString CTreeCtrl::GetItemText(HTREEITEM,hItem)const;
BOOL CTreeCtrl::SetItemText(HTREEITEM hItem,LPCTSTR lpszItem);
5. 查询 CTreeCtrl 中项目的个数
UINT CTreeCtrl::GetCount();
6.查询hItem 的父项目的句柄
HTREEITEM CTreeCtrl::GetparenItem(HTREEITEM hItem);
7.查询hItem是否有子项
BOOL CTreeCtrl::ItemHasChildren(HTREEITEM hItem);
8.取得hItem 第一个子项的句柄
HTREEITEM CTreeCtrl::GetChildItem(HTREEITEM hItem);
9.查询排在hItem前后的兄弟项
HTREEITEM CTreeCtrl::GetPrevSiblingItem(HTREEITEM hItem);
HTREEITEM CTreeCtrl::GetNextSiblingItem(HTREEITEM hItem);
10.取得选中项的句柄 取得根项的句柄
HTREEITEM CTreeCtrl::GetSelectedItem();
HTREEITEM CTreeCtrl::GetRootItem();
HTREEITEM hItem=GetRootItem(); //获取根结点,可能会有多个根结点
ItemHasChildren(hParent) //判断结点是否有孩子结点
hItem=GetChildItem(hParent); //获取第一个子结点
hItem=GetNextSiblingItem(hItem)); //获取下一个兄弟结点结点
Expand(hItem,bExpand?TVE_EXPAND:TVE_COLLAPSE);//展开/叠起结点
Select(hItem,TVGN_FIRSTVISIBLE); //设置选中结点
CString str=GetItemText(hChild); //获取结点字符串信息
HTREEITEM hCurrSel = GetSelectedItem(); //获取当前选中结点
SelectItem(hNewSel);
HTREEITEM hNewSel = HitTest(pt, &nFlags); //判断坐标是否在当前结点范围内
HTREEITEM hItem=InsertItem(dlg.m_strItemText,hItemParent); //插入结点