Results 1 to 5 of 5

Thread: Viewing IE Favorites on a WebBrowser - VB6

  1. #1

    Thread Starter
    Member MSWindowsUser's Avatar
    Join Date
    Dec 2007
    Posts
    40

    Viewing IE Favorites on a WebBrowser - VB6

    Hello, I'm making an updated version of the WebBrowser Program with new material, but I need the code of how to view the IE favorites that you've bookmarked on Visual Basic 6.

    Help...?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Viewing IE Favorites on a WebBrowser - VB6

    Moved from the CodeBank

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Viewing IE Favorites on a WebBrowser - VB6

    I think the favorites are kept in a directory under Documents and Settings\Your Name\Favorites

    I think if you just do set a DirList path to that path you will get your favorites in a DirList box

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Viewing IE Favorites on a WebBrowser - VB6

    Try this
    Code:
    Option Explicit
    
    Private Const CSIDL_FAVORITES = 6 '// Favorites
    
    Private Const MAX_PATH As Integer = 260
    
    Private Type SHFILEOPSTRUCT
        hwnd   As Long
        wFunc As Long
        pFrom As String
        pTo     As String
        fFlags  As Integer
        fAborted       As Boolean
        hNameMaps As Long
        sProgress      As String
    End Type
    
    Private Type SHIEMID
        cb As Long
        abID As Byte
    End Type
    
    Private Type ITEMIDLIST
        mkid As SHIEMID
    End Type
    
    Private Declare Function SHGetSpecialFolderLocation Lib "Shell32.dll" _
    (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
    
    Private Declare Function SHGetSpecialFolderLocationD Lib "Shell32.dll" _
    Alias "SHGetSpecialFolderLocation" (ByVal hwndOwner As Long, ByVal nFolder As Long, _
    ByRef ppidl As Long) As Long
    
    Private Declare Function SHGetPathFromIDList Lib "Shell32.dll" Alias _
    "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
    
    Private Function GetSpecialFolder(CSIDL As Long) As String
    Dim sPath As String
    Dim IDL As ITEMIDLIST
    
    GetSpecialFolder = vbNullString
    If SHGetSpecialFolderLocation(Form1.hwnd, CSIDL, IDL) = 0 Then
         sPath = Space$(MAX_PATH)
        If SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath) Then
            GetSpecialFolder = Left$(sPath, InStr(sPath, vbNullChar) - 1) & "\"
        End If
    End If
    End Function
    
    Private Sub Command1Click()
    Dim MyFavorites As String
    MyFavorites = GetSpecialFolder(CSIDL_FAVORITES)
    MsgBox MyFavorites
    End Sub

  5. #5

    Thread Starter
    Member MSWindowsUser's Avatar
    Join Date
    Dec 2007
    Posts
    40

    Re: Viewing IE Favorites on a WebBrowser - VB6

    Quote Originally Posted by Hack
    Try this
    Code:
    Option Explicit
    
    Private Const CSIDL_FAVORITES = 6 '// Favorites
    
    Private Const MAX_PATH As Integer = 260
    
    Private Type SHFILEOPSTRUCT
        hwnd   As Long
        wFunc As Long
        pFrom As String
        pTo     As String
        fFlags  As Integer
        fAborted       As Boolean
        hNameMaps As Long
        sProgress      As String
    End Type
    
    Private Type SHIEMID
        cb As Long
        abID As Byte
    End Type
    
    Private Type ITEMIDLIST
        mkid As SHIEMID
    End Type
    
    Private Declare Function SHGetSpecialFolderLocation Lib "Shell32.dll" _
    (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
    
    Private Declare Function SHGetSpecialFolderLocationD Lib "Shell32.dll" _
    Alias "SHGetSpecialFolderLocation" (ByVal hwndOwner As Long, ByVal nFolder As Long, _
    ByRef ppidl As Long) As Long
    
    Private Declare Function SHGetPathFromIDList Lib "Shell32.dll" Alias _
    "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
    
    Private Function GetSpecialFolder(CSIDL As Long) As String
    Dim sPath As String
    Dim IDL As ITEMIDLIST
    
    GetSpecialFolder = vbNullString
    If SHGetSpecialFolderLocation(Form1.hwnd, CSIDL, IDL) = 0 Then
         sPath = Space$(MAX_PATH)
        If SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath) Then
            GetSpecialFolder = Left$(sPath, InStr(sPath, vbNullChar) - 1) & "\"
        End If
    End If
    End Function
    
    Private Sub Command1Click()
    Dim MyFavorites As String
    MyFavorites = GetSpecialFolder(CSIDL_FAVORITES)
    MsgBox MyFavorites
    End Sub
    OK. How can I open the file on the menu 'Favorites' like Internet Explorer?
    A whole thing of the favorites that is...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width