Code:
Private Const MAX_PATH = 260
Private Const CSIDL_STARTUP As Long = &H7
Private Const CSIDL_SYSTEM As Long = &H25
Private Const CSIDL_COMMON_STARTUP As Long = &H18
Private Const CSIDL_INTERNET_CACHE As Long = &H20
Private Const CSIDL_PERSONAL As Long = &H5
Private Const CSIDL_PROGRAM_FILES As Long = &H26
Private Const CSIDL_DESKTOP = &H0
Private Declare Function SHGetFolderPath Lib "shfolder" _
Alias "SHGetFolderPathA" (ByVal hwndOwner As Long, _
ByVal nFolder As Long, ByVal hToken As Long, _
ByVal dwFlags As Long, ByVal pszPath As String) As Long
Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Function PathString(lngCSIDL As Long) As String
Dim strPath As String
Dim lngReturn As Long
strPath = String(MAX_PATH, 0)
lngReturn = SHGetFolderPath(0, lngCSIDL, 0, SHGFP_TYPE_CURRENT, strPath)
PathString = Left$(strPath, InStr(1, strPath, Chr(0)) - 1)
End Function
0 comments:
Post a Comment