![]() |
Desktop Development »
Shell and IE programming »
IE Programming
Intermediate
Enumerating Internet Explorer's FavoritesBy Naveen K KohliAn article on enumerating a users favorites list from Internet Explorer |
VC6Win2K, ATL, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
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:
LoadFavorites | This 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.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 9 Sep 2000 Editor: Chris Maunder |
Copyright 2000 by Naveen K Kohli Everything else Copyright © CodeProject, 1999-2009 Web09 | Advertise on the Code Project |