Click here to Skip to main content
15,867,771 members
Articles / Desktop Programming / ATL
Article

Enumerating Internet Explorer's Favorites

Rate me:
Please Sign up or sign in to vote.
3.00/5 (3 votes)
9 Sep 2000 98K   1.4K   38   9
An article on enumerating a users favorites list from Internet Explorer
  • Download source files - 24 Kb
  • Download demo project - 21 Kb
  • Introduction

    Recently I have been working on a project that involved getting the list of favorites (aka Bookmarks) in Internet Explorer. Microsoft does provide an API to dump all the favorites in a text file that follows Netscape's bookmark format. But that text file did not serve my purpose. First I needed a parser that could extract all the information from that file and secondly, the method call ImportExportFavorites on IShellUIHelper interface requires the user to select if they want to dump the favorites or not.

    This gave me a reason to search for alternatives. The answer was using the shell programming API. Favorites are stored in a user's profile as regular folders and files. Therefore I could use the file attributes to extract all the information that I needed, namely creation, modified and last access dates, URL, description of the favorite. During the search I came across a Microsoft article that described how to get started with this. With the help of that article and some of my own ideas I came up with this COM object, IFavoriteEngine, that does the trick for me.

    The implementation shows the use of the shell APIs and some COM concepts, and prepares the complete enumeration of Favorites on the system. This COM object has just two methods:

    LoadFavoritesThis method accesses all the Favorites on the system and prepares the enumeration list.
    GetFavoritesObjList</code<</td><td>This method returns
    the enumeration that was created by the <code>LoadFavorites
    method call.

    GetFavoritesObjList returns another COM object IFavoritesObjList. This object has its own methods that can be called to extract all the information. This object returns another COM object IFavoriteObject. This is the object that contains the details e.g. dates, description, etc.

    The SHGetSpecialFolderLocation API is used to get the list of all the favorites in a user's profile. The second parameter to this call is CSIDL_FAVORITES, indicating that it should fetch all the Favorites from a user profile. To get the other attributes of the favorites file and folders, the Win32 API GetFileAttributesEx has been used.

    I have included a simple Win32 console application to show how the IFavoritesEngine COM object can be used to get all the favorites on a system. The code has been written and compiled using VC++6 (SP4) on Windows 2000, Adv Server (SP1). I have only been testing the debug build. So if you find any problems with release configuration of the project, pleas e let me know.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    QuestionMissing FavoritesParser.h Pin
    Sam Hobbs26-Apr-16 13:15
    Sam Hobbs26-Apr-16 13:15 
    General2nd attempt - Now no warnings only 7 errors Pin
    hesterloli14-May-03 10:24
    hesterloli14-May-03 10:24 
    GeneralNow no warnings only 7 errors Pin
    hesterloli14-May-03 10:23
    hesterloli14-May-03 10:23 
    Generalcouldn.'t build it either Pin
    hesterloli14-May-03 10:00
    hesterloli14-May-03 10:00 
    GeneralI couldn't build your sample Pin
    rayyang200011-Sep-00 18:54
    rayyang200011-Sep-00 18:54 
    GeneralRe: I couldn't build your sample Pin
    Naveen K Kohli12-Sep-00 2:44
    Naveen K Kohli12-Sep-00 2:44 
    GeneralRe: I couldn't build your sample Pin
    rayyang200012-Sep-00 16:42
    rayyang200012-Sep-00 16:42 
    GeneralRe: I couldn't build your sample Pin
    20-Nov-00 3:02
    suss20-Nov-00 3:02 
    GeneralRe: I couldn't build your sample Pin
    Anonym4-Feb-02 10:56
    Anonym4-Feb-02 10:56 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.