Long filename to 8.3

Convert long filenames to 8.3 format.

Contributor: ANDRE V.D MERWE

> Has anyone had any luck making GetShortPathName

> to work? It's supposed to convert a long file/path

> name to a DOS 8.3 structure... but it keeps returning

> the same long file name I pass in.

Try this, it worked for me....

function ToShortPath( sPath : string ) : string;


   iLen : integer;

   sShort : string;

   szShort : PChar;


   iLen := Length( sPath );

   szShort := StrAlloc( iLen );

   GetShortPathName( PChar(sPath), szShort, iLen );

   sShort := szShort;

   StrDispose( szShort );

   Result := sShort;



Share this article!

Follow us!

Find more helpful articles: