News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

treeview enumeration

Started by egons, May 15, 2011, 07:07:50 AM

Previous topic - Next topic

egons

hi. i am masm's beginner and now working on treeview tasks. nowaday stucked w treeview's child nodes enumeration:
mov eax,255
        mov des1.cchTextMax,eax
        invoke GlobalAlloc,GMEM_FIXED+GMEM_ZEROINIT,eax; globalfree
        mov des1.pszText,eax
        mov des1.imask,LVIF_TEXT+TVIF_CHILDREN;?? tvif_image
        push esi
        mov esi,TVGN_ROOT
        xor eax,eax
tree_loop:
        invoke SendMessageA,hwndTreeView,TVM_GETNEXTITEM,esi,eax
        mov des1.hItem,eax
        test eax,eax
        je close_base
        push eax
        invoke SendMessageA,hwndTreeView,TVM_GETITEM,0,addr des1
        mov eax,des1.pszText
        invoke MessageBox,hwndTreeView,eax,offset AppName,0
        pop eax
        ;mov eax,des1.hItem
        mov esi,TVGN_CHILD;TVGN_NEXT
        jmp tree_loop
close_base:
        mov eax,des1.pszText
        invoke GlobalFree,eax
        pop esi


could you hekp me, please?
10x

egons

ok, i did it:
        mov eax,255;char szBuffer[MAXTEXTLEN+1];
        mov des1.cchTextMax,eax
        invoke GlobalAlloc,GMEM_FIXED+GMEM_ZEROINIT,eax; globalfree
        mov des1.pszText,eax
        mov des1.imask,LVIF_TEXT+TVIF_CHILDREN+TVIF_HANDLE;?? tvif_image
        push esi
        push edx
        push ecx
        mov esi,TVGN_ROOT
        xor eax,eax
tree_loop:
        invoke SendMessageA,hwndTreeView,TVM_GETNEXTITEM,esi,eax
        mov des1.hItem,eax
        test eax,eax
        je close_base
        invoke SendMessageA,hwndTreeView,TVM_GETITEM,0,addr des1
        mov eax,des1.pszText
        mov edx,des1.hItem;root
        mov ecx,0;hasroot
        invoke insert_data
        ;invoke MessageBox,hwndTreeView,eax,offset AppName,0
        .if des1.cChildren!=0
            mov eax,des1.hItem
            push eax
            mov esi,TVGN_CHILD
enum_children:
            invoke SendMessageA,hwndTreeView,TVM_GETNEXTITEM,esi,eax
            mov des1.hItem,eax
            test eax,eax
            je end_of_children
            invoke SendMessageA,hwndTreeView,TVM_GETITEM,0,addr des1
            mov eax,des1.pszText
            mov ecx,[esp]
            mov edx,0;[esp+8]
            invoke insert_data
            mov esi,TVGN_NEXT
            mov eax,des1.hItem
            jmp enum_children
end_of_children:
            pop eax
            mov des1.hItem,eax
        .endif
        mov eax,des1.hItem
        mov esi,TVGN_NEXT
        jmp tree_loop
close_base:
        pop ecx
        pop edx
        pop esi
        mov eax,des1.pszText
        invoke GlobalFree,eax

but i don't know how to enumerate child nodes of treeview :dazzled:

egons

ok, i've found task. looks like chinese guys are so much smarter :cheekygreen:
all i want is to build hierarchy in treeview.