; SHELL32 const for folder locations
Const CSIDL_DESKTOP = $0
Const CSIDL_INTERNET = $1
Const CSIDL_PROGRAMS = $2
Const CSIDL_CONTROLS = $3
Const CSIDL_PRINTERS = $4
Const CSIDL_PERSONAL = $5
Const CSIDL_FAVORITES = $6
Const CSIDL_STARTUP = $7
Const CSIDL_RECENT = $8
Const CSIDL_SENDTO = $9
Const CSIDL_BITBUCKET = $A
Const CSIDL_STARTMENU = $B
Const CSIDL_DESKTOPDIRECTORY = $10
Const CSIDL_DRIVES = $11
Const CSIDL_NETWORK = $12
Const CSIDL_NETHOOD = $13
Const CSIDL_FONTS = $14
Const CSIDL_TEMPLATES = $15
Const CSIDL_COMMON_STARTMENU = $16
Const CSIDL_COMMON_PROGRAMS = $17
Const CSIDL_COMMON_STARTUP = $18
Const CSIDL_COMMON_DESKTOPDIRECTORY = $19
Const CSIDL_APPDATA = $1A
Const CSIDL_PRINTHOOD = $1B
Const CSIDL_LOCAL_APPDATA = $1C
Const CSIDL_ALTSTARTUP = $1D
Const CSIDL_COMMON_ALTSTARTUP = $1E
Const CSIDL_COMMON_FAVORITES = $1F
Const CSIDL_INTERNET_CACHE = $20
Const CSIDL_COOKIES = $21
Const CSIDL_HISTORY = $22
Const CSIDL_COMMON_APPDATA = $23
;-------------------------------------------------------------------------------------------------------
;GetFolderPath()
;uses SHGetFolderPathA to get the wanted folder
;-------------------------------------------------------------------------------------------------------
Function GetFolderPath$(CLSID$)
Local bank%
Local s$
Local i%,b%
If CLSID=""
Return
EndIf
bank = CreateBank(256)
api_GetFolderPath(0,CLSID,0,0,bank)
s$ = ""
For i=0 To 255
b=PeekByte(bank,i)
If b=0 Then Exit
s$=s$+Chr$(b)
Next
FreeBank bank
If Right$(s$,1)<>"\" Then s$=s$+"\"
Return s$
End Function
Furthermore you need an shell32.decls file with the following content:
.lib "shell32.dll"
api_GetFolderPath%(hwnd, p1, p2, p3, out*) : "SHGetFolderPathA"
Hope this helps.
|