Ir al contenido


Foto

[TRUCO DELPHI] Nombres de Archivos Cortos y Largos.


  • Por favor identifícate para responder
No hay respuestas en este tema

#1 sir.dev.a.lot

sir.dev.a.lot

    Advanced Member

  • Miembros
  • PipPipPip
  • 545 mensajes
  • Location127.0.0.1

Escrito 01 diciembre 2016 - 07:44

[TRUCO DELPHI] Nombres de Archivos Cortos y Largos.


delphi
  1. function GetShortFileName(const FileName : string) : string;
  2. var
  3. aTmp: array[0..255] of char;
  4. begin
  5. if GetShortPathName(PChar(FileName),aTmp,Sizeof(aTmp)-1)=0 then
  6. Result:= FileName
  7. else
  8. Result:=StrPas(aTmp);
  9. end;
  10.  
  11. function GetLongFileName(const FileName : string) : string;
  12. var
  13. aInfo: TSHFileInfo;
  14. begin
  15. if SHGetFileInfo(PChar(FileName),0,aInfo,Sizeof(aInfo),SHGFI_DISPLAYNAME)<>0 then
  16. Result:= string(aInfo.szDisplayName)
  17. else
  18. Result:= FileName;
  19. end;

Saludos!


  • 1




IP.Board spam blocked by CleanTalk.