Hi,
I have to make a treeview for browsing folders and I'm using a loop to add the the available drives so I don't have no handles to the items (although I probably could if I set up an array).
Now I need to know how to get the selected item when it's double clicked. This is what I tried:
.ELSEIF iMsg==WM_NOTIFY
mov edi,lParam
assume edi:ptr NMHDR
.IF .code==NM_DBLCLK
invoke SendDlgItemMessage, hDlgRename, IDCT_TREE1, TVM_GETNEXTITEM, TVGN_CARET, 0
mov tvitem.hItem,eax
mov tvitem.imask,TVIF_HANDLE+TVIF_TEXT
mov tvitem.pszText,offset buffer
mov tvitem.cchTextMax,65
invoke SendDlgItemMessage ,hDlgRename, IDCT_TREE1, TVM_GETITEM, 0, addr tvitem
.ENDIF
TVM_GETNEXTITEM always returns 0 probably because I don't have an item handle.
Also copy&paste this somewhere into a program:
.data?
buffer db 512 dup(?)
invoke SetLastError,0
invoke ImageList_Create,16,16,ILC_COLOR16,10,0
invoke GetLastError
mov ebx,eax
invoke FormatMessage, FORMAT_MESSAGE_FROM_SYSTEM or FORMAT_MESSAGE_IGNORE_INSERTS, NULL, ebx, 0, addr buffer, 256, NULL
invoke MessageBox,NULL,addr buffer,NULL,MB_OK
Is it a bug ?
This message was edited by goofee, on 7/4/2001 8:01:16 PMOK,
I found a link to a sample in the general forum in case someone cares.
It doesn't get the item handle but it does exactly what I need (initialize the
treeviev with drives).