简体   繁体   中英

C++ Tree View Controls, Get Full path of selected item

Currently I have a tree view control and I'm handling the TVN_ITEMEXPANDING command which is fine, however I can't seem to find a way to get an absolute path from the tree view control. ie

- C:\\
  - Documents
    - Test.txt

Lets say I double click Documents I would like to get the full path which would be

'C:\\Documents'

and if I double clicked on Test.txt I would like to get the full path which would be

'C:\\Documents\\Test.txt'

Is this possible?

The "corresponding" .net control has a property called FullPath . You can take a look at the c# implementation at TreeNode.cs@GetFullPath() . You can (and have to) do pretty much the same in your code as well. (it doesn't have to be recursion, but it can be ;-))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM