Private Declare Function GetShortPathName Lib "kernel32" Alias
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As
String, ByVal cchBuffer As Long) As Long
Private Declare Function GetFullPathName Lib "kernel32" _
Alias "GetFullPathNameA" (ByVal lpFileName As String, _
ByVal nBufferLength As Long, ByVal lpBuffer As String, _
lpFilePart As Byte) As Long
Private Sub Command1_Click()
Dim aa As Long, pbase As Long
Dim FullPath As String, ShortPath As String
Dim SouStr As String
Dim len5 As Long
Dim fname() As Byte
Dim gg As String
SouStr = "C:vb5.exe"
ShortPath = String(255, 0)
aa = GetShortPathName(SouStr, ShortPath, 256)
SouStr = Left(ShortPath, InStr(1, ShortPath, Chr(0)) - 1)
Debug.Print SouStr
End Sub
|