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 GetTempPath Lib \"kernel32\" Alias \"GetTempPathA\" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Sub GetTEMPfolder(Optional ByVal showlong As Boolean = True)
Dim longname As String, shortname As String
shortname = Space(256)
GetTempPath Len(shortname), shortname
longname = Space(1024)
GetLongPathName shortname, longname, Len(longname)
MsgBox \"Tempfolder : \" & IIf(showlong = True, longname, shortname)
End Sub
Private Sub Command1_Click()
GetTEMPfolder \'长文件名
GetTEMPfolder False \'短文件名
End Sub
最新评论