Thanks Patrick..

I ended up writing this...

Function ReturnLongFileName(sShortName : String) : String;
Var
  sLongName : String;
  sTemp     : String;
  offset    : Integer;
  iSlashPos : Integer;
  SearchRec: TSearchRec;
begin
     // Add \ to short name to prevent Instr from failing
     sShortName := sShortName + '\';

     // Start from 4 to ignore the "[Drive Letter]:\" characters
     iSlashPos := Pos('\', Copy(sShortName, 4,255));

     // Pull out each string between \ character for conversion
     sLongName := '';
     Offset := iSlashPos+2;
     While iSlashPos > 0 do
       begin
          if (FindFirst(copy(sShortName, 1, Offset), faAnyFile or FADirectory, 
SearchRec) = 0) then
            sLongName := SLongName + SearchRec.Name+'\';
          iSlashPos := Pos('\', Copy(sShortName, Offset+2,255));
          Offset := Offset + ISlashPos;
          Sysutils.FindClose(SearchRec);
       end;
     Result := sLongName;
end;


Christopher Crowe (Software Developer)
Microsoft MVP, MCP

Adrock Software
Byte Computer & Software LTD
P.O Box 13-155 
Christchurch
New Zealand
Phone/Fax (NZ) 03-3651-112


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Patrick Dunford
> Sent: Saturday, 10 April 1999 19:23
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Getting the long filename from a short one?
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > Behalf Of Chris Crowe
> > Sent: Saturday, 10 April 1999 18:17
> > To: Multiple recipients of list delphi
> > Subject: [DUG]: Getting the long filename from a short one?
> >
> >
> > Does anyone know how to convert short filename back into its 
> long version?
> >
> > I think I remember there is an API call for it?
> 
> That sounds a little strange, a short name cannot be converted into a long
> one unless you know what the long name is (in effect).
> 
> FindFirst/FindNext will do this: The FindData field in a 
> TSearchRec contains
> both the long and short name representations of a filename.
> 
> snip
> 
> ------------------------------------------------------------------
> ---------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> 

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to