LongPathName – Convert a 8.3 file name to long format

Private Declare Function GetLongPathName Lib "kernel32" Alias _    "GetLongPathNameA" (ByVal lpszShortPath As String, _    ByVal lpszLongPath As String, ByVal cchBuffer As Long) As LongConst MAX_PATH = 260' Convert a short file/path name to a long name' the file or path must exist' returns a null string in case of error'' IMPORTANT: this function is only available under'            Windows 98 and Windows 2000Public Function LongPathName(ByVal FileName As String) As String    Dim length As Long, res As String    On Error Resume Next        res = String$(MAX_PATH, 0)    length = GetLongPathName(FileName, res, Len(res))    If length And Err = 0 Then        LongPathName = Left$(res, length)    End IfEnd Function

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: