I am using a TreeCtrl from within a CTreeView derived class and have called GetTreeCtrl() method to retrieve a reference. All fine there.
I would like to get a handle to one of the TVITEMs using GetItem() and passing a TV_ITEM structure reference.
Using this method I can retrieve the item text using HTREEITEM and TVIF_TEXT|TVIF_HANDLE masks.
What I would like to do however, is fill the structure with a string (.pszText) and get the control to return the item reference.
I have tried:
tvi.pszText=(LPSTR)(LPCTSTR)strItem; //previously filled item string
What happens, if you look at the debug window is the .state to value 8a8b (or something like that) reference changes, and so does the .pszText (this is filled with what looks like invalid memory). I have assumed therefore that the call is trying to return the text value by using the HTREEITEM .hitem, which is not what I want.
How can I retrieve the HTREEITEM of the item i want?