BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to get files and folders path

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
ramraj
Guest





PostPosted: Thu May 10, 2007 6:24 pm    Post subject: how to get files and folders path Reply with quote



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





PostPosted: Thu May 10, 2007 7:48 pm    Post subject: Re: how to get files and folders path Reply with quote



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





PostPosted: Fri May 11, 2007 10:16 pm    Post subject: Re: how to get files and folders path Reply with quote



"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.