1

I have a problem using Treeview control, when I try to insert items it shows the first line empty without any caption as you can see in the picture: Figure1

First,I declared a variable called TreeCaption which holds the item caption:

TreeCaption         db 'Testing!',0

then I called the procedure to insert a new item:

invoke InsertTreeViewItem,addr TreeCaption

This is the procedure:

InsertTreeViewItem proc  psztext : DWORD    
    LOCAL tvi   :  TV_ITEM
    LOCAL tvins :  TV_INSERTSTRUCT 

    mov tvi._mask,TVIF_TEXT 
    push psztext
    pop tvi.pszText
    push tvi    
    pop tvins.item  
    pop tvins.hParent,TVI_ROOT 
    mov tvins.hInsertAfter,TVI_SORT
    invoke SendMessage,hTreeview,TVM_INSERTITEM,0,addr tvins
    ret
InsertTreeViewItem endp 

Am working on RadASM as an IDE.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Rever7eR
  • 11
  • 6
  • I assume `pop tvins.hParent,TVI_ROOT` is meant to be `mov tvins.hParent,TVI_ROOT`. Are you generating a 64-bit program or a 32-bit program? I am assuming it is 32-bit since you use `psztext : DWORD` – Michael Petch May 18 '20 at 13:27
  • it's a 32bit program , I have deleted TV_ITEM structure and changed the line as you mentioned, I also added pop '''tvi.item.pszText''' and it worked . thank you so much Mr @MichaelPetch – Rever7eR May 18 '20 at 18:42

0 Answers0