取得File 8.3之文件名称格式2010-01-15說明這就是在Dos底下的短檔名,可以透過GetShortPathName取得,範例程式如下程式
"這個程式需要一個Command
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 = "D:Program FilesMicrosoft Visual StudioVB98vb6.exe"
ShortPath = String(255, 0)
aa = GetShortPathName(SouStr, ShortPath, 256)
SouStr = Left(ShortPath, InStr(1, ShortPath, Chr(0)) - 1)
Debug.Print SouStr
End Sub