Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to convert long file name in Dos 8 chr...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00359227
Message ID:
00359395
Vues:
12
Thank you George,
This is really helpful.

>>Is there a way to convert long file name and directory in the DOS 8 characters format?
>>ex:
>>c:\program files\autocad R14 => c:\progra~1\autoca~1
>
>A couple of things, including the WSH, can get this. If it's not installed, then:
DECLARE INTEGER GetShortPathName in win32api;
>  STRING @lpsource, STRING @lptarget, INTEGER nLength
>lcbuffer = SPACE(260)
>* lcfilename is the long filename
>lnresult = GetShortPathName(@lcfile, @lcbuffer, LEN(lcbuffer))
>IF lnresult > 0
>  ? LEFT(lcbuffer, lnresult)
>ENDIF
>* With the WSH
>oFSO = CREATEOBJECT('Scripting.FileSystemObject')
>oFile = oFSO.GetFile(lcfile)
>IF NOT ISNULL(oFile)
>  ? oFile.ShortName
>ENDIF
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform