By: Steve Waring
Home Pages: Journal Dolphinharbor
Created: 20021108
Last Update: 20021108
Dynamically build a menu from Internet Explorer's favorites, and convert a favorite file into a url.
From mind There is currently no API or interface method that performs this, so you have to enumerate the Favorites folder yourself.
Fortunately the work that myself and Louis Sumberg did on the WindowsShell for Dolphin, does most of the necessary heavy lifting.
This is released as TestWare; if you have any problems running this in your environment please let me know about it. It has been run successfully on WinXP, Win2k, and Win95 machines.
The above screenshot is from a ToGo test application (467k).
To install the source code, you will need to install the the "DH Shell Core" package from the Windows Shell project.
The SWIEFavorites.zip (8k) contains three packages, the core package, a sample package, and a test package which contains a functional test case.
A builder class is used to build the menus lazily in a presenter's #onAboutToDisplayMenu method. When a menu is constructed, a property is used to store enough information so that if required, the appropriate favorites folder can be located and used to build a new submenu.
The ShellObject and ShellFolder classes are used to enumerate the favorite folders and files, and access the displayNames and icons.
When a user selects a command, a message is sent to the presenter which has two arguments, the path of the favorite and its displayName.
Two COMInterfaces are included; IUniformResourceLocatorA and IPersistFile. Once we have the path of the favorite file, these two interfaces are used to load and convert the favorite into a url.
Copyright Steve Waring 2002.