SergioQ 0 Light Poster

The code below is taken from my DLL which is injected into a third party app
via a hook. What I am trying to do is read another apps Tree structure.

Going by the the first line below, the tree window (wOther) has 55 items, which is correct (I am therefore pretty sure that I have the correct window handle).

Yet, I can't get any info more info, other than how many items! My while loop runs just once, no text returned, and the next call using TVM_GETNEXTITEM returns a NULL.

Actually it seems that the TVM_GETITEM call returns a NULL which means it failed, but I can't find what's going on.

Anyone have a clue???????

Thanks

lR = SendMessage(wOther,TVM_GETCOUNT,0,0);

.....report via my window what LR is .....

hItem = (HTREEITEM)SendMessage(wOther, TVM_GETNEXTITEM, TVGN_ROOT, 0);

bStopIt = 0;
while (hItem != NULL && bStopIt++ < 50)
{
 memset(szBuffer, 0, sizeof(char)*256);
 memset(&item, 0, sizeof(TV_ITEM));
 item.hItem = hItem;
 item.mask = TVIF_TEXT | TVIF_CHILDREN;
 item.pszText = szBuffer;
 item.cchTextMax = 256;

 SendMessage(wOther, TVM_GETITEM, 0, (LPARAM)&item);

 hItem = (HTREEITEM)SendMessage(wOther, TVM_GETNEXTITEM, TVGN_NEXT, 
(LPARAM)&item);


.....report via my window what bStop and  the contents of item are .....
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.