IEFavMnu.exe Create an Internet Explorer 4.0 Favorite

ID: Q184780


The information in this article applies to:
  • Microsoft Internet Explorer (Programming) versions 4.0, 4.01


SUMMARY

IEFavMnu demonstrates how to enumerate the Favorites folder and create a Favorites menu. This sample hosts the WebBrowser control in order to facilitate testing of the Favorites menu. Channels and Shell Links are also included in the Favorites menu just as in Internet Explorer 4.0x.


MORE INFORMATION

The following files are available for download from the Microsoft Download Center. Click the file names below to download the files:

IEFavMnu.exe
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center. IEFavMnu enumerates the Favorites folder and adds the name of each item to the Favorites menu. Also, the Uniform Resource Locator (URL) to which the favorite points is added to a CStringArray object. When the user chooses a favorite from the Favorites menu, the CStringArray is used to determine where to navigate.

IEFavMnu performs the following steps in order to enumerate the Favorites folder and create the Favorites menu:
  1. Get a pointer to an identifier list (PIDL) for the Favorites folder by calling the SHGetSpecialFolderLocation() function.


  2. Enumerate all objects in the Favorites folder using the IShellFolder::EnumObjects() method.


  3. Get the display name of the favorite by calling the IShellFolder::GetDisplayNameOf() method.


  4. If the item is a folder, create a new submenu. The function that creates the Favorites menu then calls itself again in order to enumerate the subfolder.

    If the item is not a folder, it is added to the current menu.


  5. Get the actual URL of the favorite. This is different depending on if the item is an internet shortcut, a channel shortcut, a link, and so forth.


  6. Add the URL of the favorite to a CStringArray that holds the URLs for all the favorites.


IEFavMnu assigns a range of command IDs to the favorites in the menu. Currently this range is from 33000 to 35000. This means that if the user has more than 2000 favorites, attempts to navigate to any favorite after number 2000 will fail. This range of command IDs maps to the OnFavoritesURL() method. A range of command IDs is mapped to a method by using the ON_COMMAND_RANGE() macro in the message map.

When the user chooses a favorite from the menu, the OnFavoritesURL() method is called. Then the IWebBrowser2::Navigate() method is called with the URL of the favorite which is retrieved from the CStringArray. The offset into the CStringArray that contains the URL of the selected favorite is determined by subtracting the ID of the first favorite from the command ID that is sent to the OnFavoritesURL() method.

© Microsoft Corporation 1998, All Rights Reserved.
Contributions by Scott Roberts, Microsoft Corporation

Additional query words: Favorite ShellLink Channel

Keywords : kbfile kbsample kbIE400 kbIE401 InetSDKActiveDeskt kbIntDev
Version : WINDOWS:4.0,4.01
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: December 21, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.