how to get files and folders path as per system location absolute path

c++ builder

    Next

  • 1. About mciSendString
    I want to use mciSendSting to play a *.avi,But I don't know How to fill the parameter of mciSendString function:I must specify the Play Window's Handle and Its systle,Can anyone tell the how to fill the parameter? Can mciSendString play *.midi file?I can't find any information in msdn? thx.
  • 2. memo and font
    All, I am trying to set the font size to something smaller than 8. However, this does not appear to be happening. I am using TMemo on a form, as a child of a TPanel. Regards, Michael
  • 3. DBCtrlGrid and DBLookupCombo Box
    I placed a DBLookupComboBox on a DBCtrlGrid, and connected to a lookup field defined in the TADOTable that the grid is connected to. The progam compiles and displays the form, but when I click the ComboBox, I get an error message: "Operation not allowed on a DBCtrlGrid" Is it possible to use a ComboBox on a DBCtrlGrid?
  • 4. How to avoid windows to display a message if no device is in a drive-slot?
    How to avoid Windows to display a message if no device is in a drive-slot? Sorry, it sounds more difficult as it is. Having a card-reader in which (drive K:) there is a sometimes a card and sometimes not, I want to check, if K: is occupied, i.e. if a certain directory on it could be found. I did it with if(DirectoryExists("K:\\mydir")) ... In the BCB-Environment it works perfectly. The function returns a correct value, depending if the card (and directory) is in the card-reader. When running it outside the BCB-Environment Windows interrups this checking with a Messagebox, which says (translated) somehting like 'There is no medium in the drive. Please insert a medium in drive K:' How can I avoid this message to be displayed (or how can I check, if a medium is inside drive K: for not using a function which displays such a message)? Thanks a lot, Michael
  • 5. Running single copy of an application
    Hi All, I am writing an application in cppbuilder 5. I need it to behave like outlook where if you try to start the application and a copy is running it just brings that copy up. I only want one copy to run. Is there a component to handle that functionality? Thanks Glenn

how to get files and folders path as per system location absolute path

Postby 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

Postby 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

Postby 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

Postby 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...



Return to c++ builder

 

Who is online

Users browsing this forum: No registered users and 44 guest