| View previous topic :: View next topic |
| Author |
Message |
ramraj Guest
|
Posted: Thu May 10, 2007 6:24 pm Post subject: how to get files and folders path |
|
|
I am using a treeview
I want to get the folder or a file path(i.e path as according to system) upon clicking folder or file in treeview
here is my code
GetSelectedFileNames(int nGetCount,DynamicArray<AnsiString>aFiles)
{
TTreeNode * tRetNode; // used to get the selected nodes
//DynamicArray<AnsiString>aFiles;// used to get the node names
AnsiString aPath; // used to get the path of nodes
aFiles.Length = nGetCount;
for(int i=0;i < nGetCount ;i++)
{
tRetNode = Form1->ShellTreeView1->Selections[i];
aFiles[i] = tRetNode->Text;
tRetNode ++;
}
}
Is there any win 32 api or borland function to get path of folder or file |
|
| Back to top |
|
 |
Bruce Larrabee Guest
|
Posted: Thu May 10, 2007 7:48 pm Post subject: Re: how to get files and folders path |
|
|
Hello ramraj,
If you would like a method to get this
sort of thing working quickly take a look
at 'TDriveComboBox', 'TDirectoryListBox'
and 'TFileListBox'. Using them in combination
will give you basically what you are trying
to do. It is not a 'TTreeNode' type list
but is functionally similar. It does have
the functions needed to access the file system
without you having to build them.
HTH,
Bruce |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri May 11, 2007 10:16 pm Post subject: Re: how to get files and folders path |
|
|
"ramraj" <ramraj.mgv (AT) gmail (DOT) com> wrote in message
news:46431d0a$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I want to get the folder or a file path(i.e path as according to
system) upon clicking folder or file in treeview
|
TShellTreeView stores a pointer to a TShellFolder object in each tree
node's Data property. TShellFolder holds both the absolute and
relative ITEMIDLISTs of the folder/file it represents. TShellFolder
also has a PathName() method to convert the absolute ITEMIDLIST into
the type of path string that you are looking for. For example:
void GetSelectedFileNames(DynamicArray<AnsiString> &aFiles)
{
aFiles.Length = Form1->ShellTreeView1->SelectionCount;
for(int i = 0; i < aFiles.Length; ++i)
{
TTreeNode *Node = Form1->ShellTreeView1->Selections[i];
aFiles[i] =
static_cast<TShellFolder*>(Node->Data)->PathName();
}
}
Gambit |
|
| Back to top |
|
 |
|