>Is this documented somewhere?
I suggest you to look at the following MSDN article.
Creating a Shell Namespace Extension
Section 2 and 3 of this article contain some specific information about invoking these special folders using standard command line, as I did in my first post.
In my second post I mentioned how to get the CLSIDs of special folders using Shell Controls and Automation library. If you use this library, you can use the built-in methods to directly open or explore a special folder, without knowing its CLSID.
Add a reference to Shell Controls and Automation and run the following code.
___
[tt]
Private Sub Form_Load()
With New Shell
.Open ssfDRIVES
End With
End Sub[/tt]
___
You can use the [tt]Explore[/tt] method instead of [tt]Open[/tt] to open the folder in Explorer view.
You can also open/explore a virtual or special file-system folder entirely using Win32 API. The idea is to get the PIDL of a special folder using GetSpecialFolderLocation function and invoke the PIDL using ShellExecuteEx function, which works on PIDLs as well. You don't need the CLSID of the folder for this method.
___
[tt]
Option Explicit
Private Declare Sub SHGetSpecialFolderLocation Lib "shell32" (ByVal hwnd As Long, ByVal csidl As Long, ByRef ppidl As Any)
Private Declare Function ShellExecuteEx Lib "shell32" (ByRef lpExecInfo As SHELLEXECUTEINFO) As Long
Private Declare Sub CoTaskMemFree Lib "ole32" (pv As Any)
Private Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
Const SEE_MASK_IDLIST = &H4
Const CSIDL_DRIVES = &H11 'My Computer
Private Sub Form_Load()
OpenSpecialFolder CSIDL_DRIVES
End Sub
Sub OpenSpecialFolder(csidl As Long, Optional Explore As Boolean)
Dim sei As SHELLEXECUTEINFO
SHGetSpecialFolderLocation hwnd, CSIDL_DRIVES, sei.lpIDList
If sei.lpIDList = 0 Then Exit Sub 'folder does not exist/not created yet
sei.fMask = SEE_MASK_IDLIST
sei.cbSize = Len(sei)
sei.nShow = vbNormalFocus
If Explore Then sei.lpVerb = "explore"
ShellExecuteEx sei
CoTaskMemFree ByVal sei.lpIDList
End Sub[/tt]
___
CSIDL_DRIVES is the API equivalent of ssfDRIVES in ShellSpecialFolderConstants. You can pass any ssfXXX constant or lookup MSDN for an updated list of
CSIDL constants along with their description.