|
-
September 5th, 2005, 10:20 AM
#1
Problem with TreeView control and get root name
Hello. I try to do my own directory listing on TreeView control in WinAPI (no MFC) and i have big problem: I don't known how to get root name from TreeView.
I have for example this tree structure:
+ A:\
+ C:\
| ---- Temp
| ---- Windows
+ D:\
| ---- Temp
So first i make to lists all drive tapes in my computer. Second when i'm clicking on some element from this list (ex. C:\) i deliver this name "C:\" to my functions and it's make directory listing.
Now in C:\ i've got 2 directories: "Temp" and "Windows". So when i clicking on "Temp" i need to get root name from treeview control ( C:\ ) and second i need to get name of actualy clicked item.
So the problem is i don't known how to get root name from TreeView. I only known how to get name of current selected item:
TV_ITEM tv;
TV_INSERTSTRUCT tvinsert;
HTREEITEM Parent;
char Text[255] = "";
Parent=(HTREEITEM)SendDlgItemMessage(hwnd,IDC_TRV1,TVM_GETNEXTITEM,TVGN_CARET,(LPARAM)Parent);
tv.mask=TVIF_TEXT|TVIF_HANDLE;
tv.pszText=Text;
tv.cchTextMax=255;
tv.hItem=S;
SendDlgItemMessage(hwnd, IDC_TRV1, TVM_GETITEM,TVGN_PARENT,(LPARAM)&tv);
This return name of current select item. And how to get root name ? I try to search how to resolve this problem but i don't find any concrete information.
Please help me. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|