Private Declare Function lstrlenW Lib "kernel32" _ (ByVal lpString As Long) As Long
Private Declare Function SHGetFolderPath Lib "shfolder.dll" _ Alias "SHGetFolderPathA" _ (ByVal hwndOwner As Long, _ ByVal nFolder As Long, _ ByVal hToken As Long, _ ByVal dwReserved As Long, _ ByVal lpszPath As String) As Long
Private Function GetFolderPath(csidl As Long, SHGFP_TYPE As Long) _ As String Dim Buf As String
Buf = Space(MAX_LENGTH) If SHGetFolderPath(0&, _ csidl, _ -1, _ SHGFP_TYPE, _ Buf) = S_OK Then GetFolderPath = TrimNull(Buf) End If End Function
Private Function TrimNull(Str As String) As String TrimNull = Left(Str, lstrlenW(StrPtr(Str))) End Function
Private Declare Function lstrlenW Lib "kernel32" _
(ByVal lpString As Long) As Long
Private Declare Function SHGetFolderPath Lib "shfolder.dll" _
Alias "SHGetFolderPathA" _
(ByVal hwndOwner As Long, _
ByVal nFolder As Long, _
ByVal hToken As Long, _
ByVal dwReserved As Long, _
ByVal lpszPath As String) As Long
Private Function GetFolderPath(csidl As Long, SHGFP_TYPE As Long) _
As String
Dim Buf As String
Buf = Space(MAX_LENGTH)
If SHGetFolderPath(0&, _
csidl, _
-1, _
SHGFP_TYPE, _
Buf) = S_OK Then
GetFolderPath = TrimNull(Buf)
End If
End Function
Private Function TrimNull(Str As String) As String
TrimNull = Left(Str, lstrlenW(StrPtr(Str)))
End Function
Private Declare Function lstrlenW Lib "kernel32" _ (ByVal lpString As Long) As Long
Private Declare Function SHGetFolderPath Lib "shfolder.dll" _ Alias "SHGetFolderPathA" _ (ByVal hwndOwner As Long, _ ByVal nFolder As Long, _ ByVal hToken As Long, _ ByVal dwReserved As Long, _ ByVal lpszPath As String) As Long
Private Function GetFolderPath(csidl As Long, SHGFP_TYPE As Long) _ As String Dim Buf As String
Buf = Space(MAX_LENGTH) If SHGetFolderPath(0&, _ csidl, _ -1, _ SHGFP_TYPE, _ Buf) = S_OK Then GetFolderPath = TrimNull(Buf) End If End Function
Private Function TrimNull(Str As String) As String TrimNull = Left(Str, lstrlenW(StrPtr(Str))) End Function