#include once "window9.bi"

Function GetIndexImageTreeView(ByVal gadget As Integer, ByVal item As Integer,ByVal flag As Integer=0) As integer Export
  Dim TV_ITEM_ As TV_ITEM
  TV_ITEM_.hItem=Cast(HTREEITEM,item)
  if flag=0 Then
    TV_ITEM_.mask=TVIF_IMAGE
    SendMessage(GadgetID(gadget),TVM_GETITEM,0,cast(LPARAM,@TV_ITEM_))
    Return  TV_ITEM_.iImage
  Else
    TV_ITEM_.mask=TVIF_SELECTEDIMAGE
    SendMessage(GadgetID(gadget),TVM_GETITEM,0,cast(LPARAM,@TV_ITEM_))
    Return  TV_ITEM_.iSelectedImage
  End If
End Function
