| View previous topic :: View next topic |
| Author |
Message |
ramraj Guest
|
Posted: Fri May 11, 2007 3:20 pm Post subject: how to get files and folders path as per system location abs |
|
|
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
Please help me in regarding
how to get the file or folders path according to system path
Suppose there is a file in "D:/MRF/cars/wheels" it must give the same path if i want wheels
but what i m gettin is
Suppose my application is in "C:/XYZ" in system
if i m searching for wheels it is giving "C:/XYZ/wheels"
help me if there is any function to get the absolute path according to system file or folder locations |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Fri May 11, 2007 4:19 pm Post subject: Re: how to get files and folders path as per system location |
|
|
ramraj wrote:
| Quote: | I am using a treeview
|
Please do not start a new thread every time. You are supposed
to reply to a message instead. (Like I do here).
You already showed that code and you are not answering my questions.
By asking for code we want you to show also how you call
your code (which exact parameters) and what the user has to
to before and so.
Hans. |
|
| Back to top |
|
 |
JD Guest
|
Posted: Fri May 11, 2007 5:30 pm Post subject: Re: how to get files and folders path as per system location |
|
|
"ramraj" <ramraj.mgv (AT) gmail (DOT) com> wrote:
| Quote: |
[...] Please help me in regarding how to get the file or
folders path according to system path
|
With the way that you have it setup, you'll need to traverse
back up the tree nodes and rebuild the path. For example
(untested):
AnsiString Path;
TTreeNode *Node;
for( int x = 0; x < SelectionCount; ++x )
{
Node = Selections[ x ];
Path = Node->Text;
while( Node->AbsoluteIndex > 0 )
{
Node = Node->Parent;
Path = Node->Text + "\\" + Path;
}
}
I would also suggest that you use a virtual TTreeView instead
because a drive listing can easily overwhelm what a TTreeView
can efficiently support.
~ JD |
|
| 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 as per system location |
|
|
"ramraj" <ramraj.mgv (AT) gmail (DOT) com> wrote in message
news:46444382$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I am using a treeview
|
See my reply in the other thread you started.
Gambit |
|
| Back to top |
|
 |
|