VB Code:
Private Const MAX_PATH As Long = 260
Private Const S_OK As Long = 0
Private Const SHGFP_TYPE_CURRENT As Long = &H0
Private Const CSIDL_FAVORITES As Long = &H6
Private Declare Function DoOrganizeFavDlg Lib "shdocvw" _
(ByVal hWnd As Long, _
ByVal lpszRootFolder As String) As Long
Private Declare Function SHGetFolderPath Lib "shfolder" _
Alias "SHGetFolderPathA" _
(ByVal hwndOwner As Long, _
ByVal nFolder As Long, _
ByVal hToken As Long, _
ByVal dwReserved As Long, _
ByVal lpszPath As String) As Long
Private Sub Command1_Click()
DoOrganizeFavDlg hWnd, GetFolderPath(CSIDL_FAVORITES)
End Sub
Private Function GetFolderPath(CSIDL As Long) As String
Dim sPath As String, sTmp As String
sPath = Space$(MAX_PATH)
If SHGetFolderPath(Me.hWnd, CSIDL, 0&, SHGFP_TYPE_CURRENT, sPath) = S_OK Then
GetFolderPath = Left$(sPath, InStr(sPath, Chr$(0)) - 1)
End If
End Function
Stripped down version of: