// find the currently selected item
HTREEITEM hCurSel = pCtrl->GetNextItem(TVI_ROOT, TVGN_CARET);

解决方案 »

  1.   

    调用GetCount()函数,得到点击的ITEM,
      

  2.   

    getcount()是不是返回当前条目的序号啊?
    是不是按照1、2、3、4...的顺序来对应控件中的排列顺序?
      

  3.   

      CPoint posMouse,curPoint;
       GetCursorPos(&posMouse);
        ScreenToClient(&posMouse);    UINT nFlags;
        HTREEITEM hItem=GetTreeCtrl().HitTest(posMousePoint, &nFlags);
      

  4.   

    嘿嘿,我有个朋友叫eekaola
    你们到是可以成立一个csdn考拉大联盟^^
      

  5.   

    使用:
    UINT nFlags;
    HTREEITEM hItem=GetTreeCtrl().HitTest(posMousePoint, &nFlags); 
    的时候,注意把nFlags赋予下面你需要的值,那么,就能获得你点击发生时,
    你所需要的ITEM。TVHT_ABOVE  Above the client area.  
    TVHT_BELOW  Below the client area.  
    TVHT_NOWHERE  In the client area, but below the last item.  
    TVHT_ONITEM  On the bitmap or label associated with an item.  
    TVHT_ONITEMBUTTON  On the button associated with an item.  
    TVHT_ONITEMICON  On the bitmap associated with an item.  
    TVHT_ONITEMINDENT  In the indentation associated with an item.  
    TVHT_ONITEMLABEL  On the label (string) associated with an item.  
    TVHT_ONITEMRIGHT  In the area to the right of an item.  
    TVHT_ONITEMSTATEICON  On the state icon for a tree view item that is in a user-defined state.  
    TVHT_TOLEFT  To the left of the client area.  
    TVHT_TORIGHT  To the right of the client area.  
      

  6.   

    我的程序是基于DIALOG的程序
    截面上有TREE BOX和LIST BOX两个控件
    实现的目的是点击一下TREE BOX中的叶子选项
    在LIST BOX中出现相应的列表项
    双击LIST BOX中的表项则弹出一个DIALOG
    -----------------------------------------
    谢谢