Skip to content

How to select an item from an external TreeView?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #187238
    method
    Member

    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

    #187243
    Chike
    Member

    There is a small loop I once wrote.
    http://www.imfiles.com/topic/paltalk-buddy-list/
    Just replace the macros with TVM_ messages and use TVM_SELECTITEM to select the item you want.

    #187242
    method
    Member

    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)
    #187241
    Chike
    Member

    code: TVGN_CARET
    hitem the value returned by TVM_GETNEXTITEM

    #187240
    method
    Member

    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)

    #187239
    Chike
    Member

    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));
    }
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.