
Help, need API to get short filenames (such as: c:\progra~1\bla.txt)
Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" _
(ByVal lpszLongPath As_ String, ByVal lpszShortPath As String, ByVal
cchBuffer As Long) As Long
Function ShortName(lpszLongPath As String) As String
Dim lpszShortPath As String
Dim cchBuffer As Long
Dim lngRet As Long
lpszLongPath = lpszLongPath
lpszShortPath = String$(255, 0)
cchBuffer = Len(lpszShortPath)
lngRet = GetShortPathName(lpszLongPath, lpszShortPath, cchBuffer)
If lngRet > cchBuffer Then
lpszShortPath = String$(lngRet, 0)
cchBuffer = Len(lpszShortPath)
lngRet = GetShortPathName(lpszLongPath, lpszShortPath, cchBuffer)
End If
ShortName = Left(lpszShortPath, lngRet)
End Function
--
Tom Lake
ICQ #25589135