GetSpecialFolderLocation - no lib required

BlitzPlus Forums/BlitzPlus Programming/GetSpecialFolderLocation - no lib required

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This code does not require any dll's. Now you can write installers for your programs.

Someone should convert the compression routines in the archives to compress a bank - this makes a lot more sense than creating a compressed file on your hard drive.

Maybe ASPack or UPX could be used to compress the installer.

;.lib "shell32.dll"
;SHGetSpecialFolderLocation%(hwnd%,folder%,pidl*)
;SHGetPathFromIDList%(pidl%,pszPath*)

Notify GetSpecialFolderLocation(CSIDL_PROGRAMS)


Const MAX_PATH=260

Const CSIDL_PROGRAMS=2					;Program Groups Folder
Const CSIDL_PERSONAL=5					;Personal Documents Folder
Const CSIDL_FAVORITES=6					;Favorites Folder
Const CSIDL_STARTUP=7					;Startup Group Folder
Const CSIDL_RECENT=8					;Recently Used Documents Folder
Const CSIDL_SENDTO=9   					;Send To Folder
Const CSIDL_STARTMENU=11  				;Start Menu Folder
Const CSIDL_DESKTOPDIRECTORY=16  		;Desktop Folder
Const CSIDL_NETHOOD=19					;Network Neighborhood Folder
Const CSIDL_TEMPLATES=21				;Document Templates Folder
Const CSIDL_COMMON_STARTMENU=22			;Common Start Menu Folder
Const CSIDL_COMMON_PROGRAMS=23			;Common Program Groups Folder
Const CSIDL_COMMON_STARTUP=24			;Common Startup Group Folder
Const CSIDL_COMMON_DESKTOPDIRECTORY=25	;Common Desktop Folder
Const CSIDL_APPDATA=26					;Application Data Folder
Const CSIDL_PRINTHOOD=27				;Printers Folder
Const CSIDL_COMMON_FAVORITES=1			;Common Favorites Folder
Const CSIDL_INTERNET_CACHE=32			;Temp. Internet Files Folder
Const CSIDL_COOKIES=33					;Cookies Folder
Const CSIDL_HISTORY=34					;History Folder

Function GetSpecialFolderLocation$(folder)
temp=CreateBank(4)
SHGetSpecialFolderLocation(0,2,temp)
pidl=PeekInt(temp,0)
FreeBank temp
If Not pidl Return
temp=CreateBank(MAX_PATH)
SHGetPathFromIDList(pidl,temp)
s$=PeekString(temp,0)
FreeBank temp
Return s
End Function