Browse for Folder:
In the Page Shell32 Example here I gave an example of it's use to browse for a folder and get info on various files within the Folder. This is the 1st part of the wider Shell32.dll. In May 2002 I looked @ this function and realised its' potential, having looked @ microsoft specs for this.
Requires DLL version shell32.dll version 4.71 or later
Operating systems
Win2000, WinNT 4.0 with Internet Explorer 4.0, Win98, Win95 with Internet Explorer 4.0
Item Identifiers and Identifier Lists
The Shell uses object identifiers within the Shell's namespace. All objects visible in the Shell (files, directories, servers, workgroups, and so on) have unique identifiers among the objects within their parent folder. These identifiers are called item identifiers, and they have the SHITEMID data type as defined in the Shtypes.h header file. An item identifier is a variable-length byte stream that contains information that identifies an object within a folder. Only the creator of an item identifier knows the content and format of the identifier. The only part of an item identifier that the Shell uses is the first two bytes, which specify the size of the identifier.
For the API declaration the SHITEMID structure looks like this;
Type SHITEMID 'mkid
cb As Long 'Size of the ID (including cb itself)
abID As Byte 'The item ID (variable length)
End Type
Each parent folder has its own item identifier that identifies it within its own parent folder.
Thus, any Shell object can be uniquely identified by a list of item identifiers. A parent folder keeps a list of identifiers for the items it contains. The list has the ITEMIDLIST data type. Item identifier lists are allocated by the Shell and may be passed across Shell interfaces, such as IShellFolder. It is important to remember that each identifier in an item identifier list is only meaningful within the context of its parent folder.
Type ITEMIDLIST 'idl
mkid As SHITEMID
End Type
An application can set a shortcut's item identifier list by using the SetIDList method. This method is useful when setting a shortcut to an object that is not a file, such as a printer or disk drive. An application can retrieve a shortcut's item identifier list by using the GetIDList method.
What is a PIDL? Why not just use file system paths?
A PIDL (Program ID list) is a way of identifying any namespace object. You can also use paths to identify namespace objects, but only if they are part of the file system. With namespace objects that are not part of the file system, you must use PIDLs.
Public Const BIF_BROWSEFORCOMPUTER = &H1000
Public Const BIF_BROWSEFORPRINTER = &H2000
Public Const BIF_BROWSEINCLUDEFILES = &H4000
Public Const BIF_BROWSEINCLUDEURLS = &H80
Public Const BIF_DONTGOBELOWDOMAIN = &H2
Public Const BIF_EDITBOX = &H10
Public Const BIF_NEWDIALOGSTYLE = &H40
Public Const BIF_RETURNFSANCESTORS = &H8
Public Const BIF_RETURNONLYFSDIRS = &H1
Public Const BIF_SHAREABLE = &H8000
Public Const BIF_STATUSTEXT = &H4
Public Const BIF_USENEWUI = &H40
Public Const BIF_VALIDATE = &H20
Public Const BIF_NONEWFOLDERBUTTON = &H200
CSIDL values provide a unique system-independent way to identify special folders
used frequently by applications, but which may not have the same name or location
on any given system. For example, the system folder may be
"C:\Windows\System" on one system and "C:\Winnt\System32" on another, typically Work :-)
Tip:
Enum the CSIDL constants for easier data changing.
Make sure Auto List Member is Ticked — Displays a list that contains information that would logically complete the statement at the current insertion point.
eg Typing in SpecFolders gives you all the Constants below
Here is The List I was able to gather = 53
Some of which may NOT be avail for your OS
Make it Public so it is avail to All your Modules
Public Enum SpecFolders
CSIDL_APPDATA = &H1A
CSIDL_BITBUCKET = &HA
CSIDL_COMMON_DESKTOPDIRECTORY = &H19
CSIDL_COMMON_DOCUMENTS = &H2E
CSIDL_COMMON_FAVORITES = &H1F
CSIDL_COMMON_PROGRAMS = &H17
CSIDL_COMMON_STARTMENU = &H16
CSIDL_COMMON_STARTUP = &H18
CSIDL_COMMON_TEMPLATES = &H2D
CSIDL_COMMONALTSTARTUP = &H1E
CSIDL_COMMONAPPDATA = &H23
CSIDL_COMMONDESKTOP = &H0
CSIDL_COMMONMYMUSIC = &H35
CSIDL_COMMONMYPICTURES = &H36
CSIDL_COMMONMYVIDEOS = &H37
CSIDL_COMMONSTARTADMIN = &H2F
CSIDL_CONNECTIONS = &H31
CSIDL_CONTROLS = &H3
CSIDL_DRIVES = &H11
CSIDL_FAVORITES = &H6
CSIDL_FONTS = &H14
CSIDL_LOCALALTSTARTUP = &H1D
CSIDL_LOCALAPPDATA = &H1C
CSIDL_LOCALAPPMSCDBURNING = &H3B
CSIDL_LOCALCOOKIES = &H21
CSIDL_LOCALDESKTOPDIRECTORY = &H10
CSIDL_LOCALHISTORY = &H22
CSIDL_LOCALINTERNETCACHE = &H20
CSIDL_LOCALMYVIDEOS = &HE
CSIDL_LOCALSTARTADMIN = &H30
CSIDL_MSHOME = &H3D
CSIDL_MYMUSIC = &HD
CSIDL_MYPICTURES = &H27
CSIDL_NETHOOD = &H13
CSIDL_NETWORK = &H12
CSIDL_PERSONAL = &H5
CSIDL_PRINTERS = &H4
CSIDL_PRINTHOOD = &H1B
CSIDL_PROFILE = &H28
CSIDL_PROGRAM_FILES = &H26
CSIDL_PROGRAM_FILES_COMMON = &H2B
CSIDL_PROGRAM_FILES_COMMONX86 = &H2C
CSIDL_PROGRAM_FILESX86 = &H2A
CSIDL_PROGRAMS = &H2
CSIDL_RECENT = &H8
CSIDL_RESOURCES = &H39
CSIDL_SENDTO = &H9
CSIDL_STARTMENU = &HB
CSIDL_STARTUP = &H7
CSIDL_SYSTEM = &H25
CSIDL_SYSTEMX86 = &H29
CSIDL_TEMPLATES = &H15
CSIDL_WINDOWS = &H24
End Enum