Convert filenames Longs -> Shorts  

Send By: Q3 Team
Web : www.q3.nu
Email: dlib@q3.nu
Date: 13/02/00

Tip accessed 534 times

 


That is to say, to convert a long file name as: 'NombreDeFicheroLargo.pas' in 'NombreD~1.pas'



   Function GetShortFileName(Const FileName : String) : String;
    var
      aTmp: array[0..255] of char;
    begin
      if GetShortPathName(PChar(FileName),aTmp,Sizeof(aTmp)-1)=0 then
         Result:= FileName
      else
         Result:=StrPas(aTmp);
    end;





Lord Trancos said me:
If you use Delphi 4 or higher, you have in the SysUtils unit the function ExtractShortPathName for make this operation.