'treeview text
'   检索指定项目的文本。
'   hWndControl: 控件的句柄 (例如  HWND_FORM1_TREEVIEW1)   
'   hItem:       The handle of the item to retrieve the text for.
'   Returns:     The text for the specified item.
Function FF_TreeView_GetText (ByVal hWndControl As HWND, ByVal hItem As HANDLE) As CWSTR 

    Dim ti      As TV_ITEM
    Dim zText   As wString * MAX_PATH
  
    '检查窗口句柄是否有效
    If IsWindow(hWndControl) Then  
    
        'Set up the item structure...
        ti.hItem      = hItem                                        
        ti.mask       = TVIF_TEXT                                    
        ti.cchTextMax = MAX_PATH
        ti.pszText    = VarPtr(zText )                              
        
        'Query the tree...
        If TreeView_GetItem (hWndControl, VarPtr(ti) ) Then     
           Return zText
        End If
    
    End If
       Return ""

End Function

