how to get files and folders path as per system location absolute path
by ramraj » Sat, 12 May 2007 19:20:50 GMT
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
Re: how to get files and folders path as per system location absolute path
by Hans Galema » Sat, 12 May 2007 20:19:52 GMT
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.
Re: how to get files and folders path as per system location absolute path
by JD » Sat, 12 May 2007 21:30:02 GMT
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
Re: how to get files and folders path as per system location absolute path
by Remy Lebeau (TeamB) » Sun, 13 May 2007 02:16:55 GMT
See my reply in the other thread you started.
Gambit
Similar Threads:
1.how to get files and folders path as per system location absolute path
Hi,
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
2.get folder-path from file-path
I don't find .net lib method to return the folder-path of a file-path.
I'm probably not looking hard enough ... I've checked the
System.IO.File,Path,Directory libs
3.absolute path to relative path conversion
4.Getting path from the full path and file name
Hello again,
This is my second question today. The question is how to get just the path
info from a string that contains path and file name information. I am
looking an MFC or WinAPI function to do that because I don't want to do it
manually.
Thanks,
5.Getting the folder path for an Outlook 2000 folder
Hi all,
I'm currently trying to make an application of mine compatible with Outlook
2000 since I have discovered the the FolderPath property does not exist in
the version 9 TLB. What I need to be able to do is build a folder path from
the current folder backward up through the parent folders in the folder
tree. I know I have access to a folders Parent property but being a newbie
Delphi programmer I'm not really sure how to use that vraible once I have
it.
I have some skeleton code below:
function TPST_Engine.GetFolderPath(CurrentFolder: MAPIFolder): string;
var
Path: string;
VarRoot: IDispatch;
ParentFolder: MAPIFolder;
begin
// Get the current folder path. This function is needed to
// maintain compatibility with Outlook 2000
Path := '/' + CurrentFolder.Name;
VarRoot := CurrentFolder.Parent;
// while VarRoot <> // what value is returned here if there is no
parent?????
// How do I use the VarRoot value to set the parent folder to my
ParentFolder <----------- What do I do here???????
// variable
GetFolderPath := Path;
end;
My solution will need to go into the while loop as I don't know before hand
how 'buried' the subfolder may be. So I will need to build up the path
string regardless of how many parents and subfolders there are.
Thanks for any help.
Mark
6. how to get absolute path from local path?
7. Generated files with attributes and absolute/relative paths
8. Absolute and relative paths in VC6 dsp files...