|
Option Explicit
Private Declare Function GetLongPathName Lib "kernel32" Alias _
"GetLongPathNameA" (ByVal lpszShortPath As String, _
ByVal lpszLongPath As String, _
ByVal cchBuffer As Long) As Long
Private Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) As Long
Private Function LongPathName(ByVal ShortName As String) As String
Dim n As Long
Dim Buffer As String
n = 260
Buffer = String$(n, 0)
n = GetLongPathName(ShortName, Buffer, n)
If n > 0 Then
LongPathName = Left$(Buffer, n)
End If
End Function
Private Sub Command1_Click()
lblLong = LongPathName(txtPath)
End Sub
|