Dos - Convertire Un Nome Lungo Di File In Formato DOS




Api # Convertire un nome lungo di file In formato DOS
------------------------------------------------------------------------
La funzione sottostante converte i nomi di file o Do path lunghi In modalita' DOS (non piu' di 8 caratteri)
Declare Function GetShortPathName Lib "KERNEL32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Public Function GetShortFileName(ByVal FileName As String) As String
Dim rc As Long
Dim ShortPath As String
Const PATH_LEN& = 164
ShortPath = String$(PATH_LEN + 1, 0)
rc = GetShortPathName(FileName, ShortPath, PATH_LEN)
GetShortFileName = Left$(ShortPath, rc)
End Function

Dove FileName e' il path o il nome del file da convertire e ritorna un nome DOS compatibile, pertanto si dichiarera':
Dim Lblshort, LongName As String
Lblshort = GetShortFileName(LongName)










( dosconvertireunnomelungodifileinformatodos.html )- by Paolo Puglisi - Modifica del 17/12/2023