Главная страница | назад





Article #17398: Getting the longfilename from a file.

 Question and Answer Database

FAQ2398D.txt   Getting the longfilename from a file.
Category   :Windows API
Platform    :All
Product    :All 32 bit  

Question:
How do I get the long file name of a file or directory from the
short file name?


Answer:
You can use the Win32_Find_Data member of TSearchRec to extract
this information.

Example:

procedure TForm1.Button1Click(Sender: TObject);
var
  SearchRec : TSearchRec;
  Success : integer;
begin
  Success := SysUtils.FindFirst('C:\DownLoad\dial-u~1.htm',
                                faAnyFile,
                                SearchRec);
  if Success = 0 then begin
    ShowMessage(SearchRec.FindData.CFileName);
  end;
  SysUtils.FindClose(SearchRec);
end;

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99