Pastetool #49

URL: , Paste another

Private Declare Function GetLongPathName Lib "kernel32" Alias _
    "GetLongPathNameA" (ByVal lpszShortPath As String, _
    ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long

Const 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 2000

Public 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 If
End Function

Download code

This visual basic code was pasted on September 24, 2009




Protected with advance Anti-SPAM techniques :)
Coded and designed by Fedmich
Follow us on Twitter