tree view get info from selected item
Hello, i have a tree view control with lots of items. I wanna to make context menu to each item (due to lets say its bmp image in tree) on right click.
Everything works perfect, I can get HTREEITEM of selected item with right click, but I am not sure how to continue.
The selected item - HTREEITEM - is in Selected (or also in tinf.hItem, I suppose): Selected = TreeView_HitTest(hTree, &tinf); //WORKS
I thought I should do something like this (to find out if selected item has g_Image1 bitmap):
TVITEM item;
item.hItem = tinf.hItem; (or Selected)
item.iImage = g_Image1;
item.iSelectedImage = g_Image1;
item.mask = TVIF_SELECTEDIMAGE | TVIF_IMAGE;
and then call some:
SendDlgItemMessage(hwnd, IDC_TREE, TVM_GETITEM, TVGN_CARET, (LPARAM)&item); (to retrieve complet data to the same item, and access it later) ... but this doesnt works.
Did I missunderstand it? How can I get some info from selected item if I have only its HTREEITEM .
Thank YOU.
Re: tree view get info from selected item
Why are you setting iImage and iSelectedImage? Set hItem only, since that is what you are searching on.