How to select an item from an external TreeView?

You can talk about VB programming here

How to select an item from an external TreeView?

Postby method » Sun Apr 25, 2010 6:23 pm


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
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Re: How to select an item from an external TreeView?

Postby Chike » Tue Apr 27, 2010 9:58 am

There is a small loop I once wrote.
paltalk-buddy-list-t17798.html#p75449
Just replace the macros with TVM_ messages and use TVM_SELECTITEM to select the item you want.
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm

Re: How to select an item from an external TreeView?

Postby method » Tue Apr 27, 2010 8:26 pm

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 ?

Code: Select all
  Const TV_FIRST = &H1100
 Const TVM_SELECTITEM = (TV_FIRST + 11)
 TreeView_Select = SendMessage(hWnd, TVM_SELECTITEM, ByVal code, ByVal hItem)
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Re: How to select an item from an external TreeView?

Postby Chike » Tue Apr 27, 2010 10:23 pm

code: TVGN_CARET
hitem the value returned by TVM_GETNEXTITEM
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm

Re: How to select an item from an external TreeView?

Postby method » Mon May 03, 2010 7:53 pm

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)
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Re: How to select an item from an external TreeView?

Postby Chike » Wed May 05, 2010 10:03 am

same loop as in the excample with massages instead of macros.
Code: Select all
   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("%s\n", 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("  %s\n", 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));
    }
Image
Chike
imFiles Master
imFiles Master
 
Posts: 581
Joined: Sun May 13, 2007 6:20 pm


Return to Visual Basic Programming

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests