does anyone know how to get the "item" state esp. the text from the list in a tree view

i am able to get the "handle" of the "item" by sending a message (via SendMessage() ) (TVM_GETNEXTITEM-TVGN_ROOT).

i am not able to get the properties of the item. i am trying to use TVM_GETITEM in the SendMessage() call but it is returning FALSE.

am i doing right or is there any other way of getting the text of the items in a tree view ?

Posted on 2001-12-05 06:56:23 by goto
You have to fill in the TV_ITEM struct to tell TVM_GETITEM
what information you want. So, to get the text you need

push "handle" to item
pop TV_ITEM.hItem
mov TV_ITEM.cchTextMax, "size of your buffer"
mov TV_ITEM.pszText, "address of your buffer"

invoke SendMessage,"handle of treeview",TVM_GETITEM,0, "addr TV_ITEM"

Now "your buffer" contains the text you wanted.
Posted on 2001-12-05 08:56:58 by anon
why do we have to do push-pop combo

the return value is still FALSE

do we have to do something with

state &

variables of the TV_ITEM ?

Posted on 2001-12-06 07:45:27 by goto
The push/pop is because you can't
mov mem_variable1,mem_variable2.
You could do this
mov eax,mem_variable2
mov mem_variable1,eax
push mem_variable2
pop mem_variable1

As for the 'state'/'statemask' question, you would only need
these if you are changing the state image. You would also
need to add TVIF_STATE to 'imask'. The state image is an extra
image that is placed just to the left of the icon image. It could
be a checkbox or some other symbol of your choice since you
also have to supply the state image list yourself.

Now, why does it return FALSE ?? I don't know without seeing
some code. But I hope you did not try to use the TV_ITEM struct
directly as in my example code. You need to use a pointer to a
TV_ITEM struct.
Posted on 2001-12-06 09:14:05 by anon