How to select an item from an external TreeView?

Hi all . I wonder how i can select an item from a treeview(which is paltalk buddy list treeview) having the handle of treeview and position of item in treeview? could any one show me how i can write a CrossProcess function giving it the handle of treeview. Looking forward for replies.Thanks

5 thoughts on “How to select an item from an external TreeView?

  1. Thanks for you reply chike. I am trying to do this in vb6. So could you explain to me how to get value of hItem and what is it? Is it treeview item index ?Furthermore, how to get ByVal code? and what is it ? I assume hWnd is the handle of treeview right ? could you look at this code and tell me if this is the right way to do it in VB6. I already know how to get handle of treeview and total treeview item.Looking forward for your reply.

    hWnd: handle of treeview
    code:?
    hItem:?
    TreeView_Select : is it value of selected item in our case buddy name ?

      Const TV_FIRST = &H1100
    Const TVM_SELECTITEM = (TV_FIRST + 11)
    TreeView_Select = SendMessage(hWnd, TVM_SELECTITEM, ByVal code, ByVal hItem)
  2. Chick could you explain to me what TVM_GETNEXTITEM, TVGN_NEXT values are and method to get them ? Furthermore why hItem is 2 place in sendMesange ? I am just trying to learn how i could search for a name in treeview and highlight it and be happy if you explain to me the alghoritm for it.Thanks

    hItem = SendMessage(hlwd, TVM_GETNEXTITEM, TVGN_NEXT, hItem)

  3. same loop as in the excample with massages instead of macros.


    HWND gradienttreeviewclass = FindWindowEx(atla, 0, "gradienttreeviewclass", NULL);
    HTREEITEM htvitem = (HTREEITEM) //TreeView_GetRoot(gradienttreeviewclass);
    SendMessage(gradienttreeviewclass, TVM_GETNEXTITEM, TVGN_ROOT, NULL);

    char text[256];
    while (htvitem) {
    GetTVItem(gradienttreeviewclass, htvitem, text, 256);
    // un-comment the '|| true' to see onffine too
    if (_strnicmp("offline", text, 7) /*|| true*/) {
    printf("%sn", text);
    // get 1st buddy in this group
    HTREEITEM htvsubitem = (HTREEITEM) //TreeView_GetChild(gradienttreeviewclass, htvitem);
    SendMessage(gradienttreeviewclass, TVM_GETNEXTITEM,
    TVGN_CHILD, PtrToLong(htvitem));
    while (htvsubitem) {
    GetTVItem(gradienttreeviewclass, htvsubitem, text, 256);
    printf(" %sn", text);
    // get next buddy
    htvsubitem = (HTREEITEM) //TreeView_GetNextSibling(gradienttreeviewclass, htvitem1);
    SendMessage(gradienttreeviewclass, TVM_GETNEXTITEM,
    TVGN_NEXT, PtrToLong(htvsubitem));
    }
    }
    // get next group
    htvitem = (HTREEITEM)//TreeView_GetNextSibling (gradienttreeviewclass, htvitem);
    SendMessage(gradienttreeviewclass, TVM_GETNEXTITEM,
    TVGN_NEXT, PtrToLong(htvitem));
    }

Leave a Reply

You must Register or Login to comment on How to select an item from an external TreeView?