Link to home
Start Free TrialLog in
Avatar of donkey_kong_jr2003
donkey_kong_jr2003

asked on

Import IE favorites into Visual Basic 6 Program

Hi all,
I would like to know how I can open and recursively read the Internet Explorer favorites menu.  I would also like to know how to read the URL linked to each bookmark.  The last thing I would like to do is be able to open up the "Add To Favorites..." dialog from within my VB program.  After opening the Add to Favorites dialog, I need to be able to retrieve the information that the user added.

I realize I will need to use some API, but which ones, and how to implement.  

Thanks!!!!!
Avatar of AzraSound
AzraSound
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of AzraSound
AzraSound
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of donkey_kong_jr2003
donkey_kong_jr2003

ASKER

Hi,
I am having trouble getting this code to work.  Stepping through the code, I found that the calls to:

hFile = FindFirstFile(sPath, WFD) and  Loop While FindNextFile(hFile, WFD)

Seem to be returning random values, especially the call to FindNextFile(hFile, WFD).  The big problem is that the loop only runs about 2 or 3 times and each time through WFD.cFileName contains about 15 files names, not just 1.  This causes the loop to end early.  Like I said before, each time I run the code, it will begin with a random file name.

Thanks
What does the code do when you run it?  Does it not list your favorites in the listview?  What do you mean by random values?
I did manage to get this to work.  (I was not using a listview, I created my own menu).  I was wondering if there was an simpler way to display the "Add To Favorites..." dialog.  I have seen this done in C++ with a few lines of code.  I seen some sample in VB that looked simple but never could compile them.
thanks
Never seen it done any other way than this in VB.
I found a much simpler way to open the Add Favorites dialog.  All you need to do is use:

Dim Shell
Set Shell = CreateObject("Shell.UIHelper")

This then gives you access to the AddFavorite method.  All this in a couple lines of code!
Yes but I don't believe that method gives you the ability to get any info back about the operation, which was part of your initial request:

"After opening the Add to Favorites dialog, I need to be able to retrieve the information that the user added"
BTW, though a few lines of code may look more appealing and be easier to work with, that is the only advantage.  This is not a speedier operation because, #1, there is the over head of creating the ShellUIHelper object, and #2, the object is more than likely doing the exact operation as outlined in my links (via Windows API) under the covers.
You are right, but I think this way works better in my situation.  Every time the user open the Favorites popup menu I am dynamically generating the contents before it is displayed.  So after the user adds the link, they will see in in the list the next time that they display the menu.
You dynamically add them using the code I posted before as well.  Like I said, its really just a wrapper around the code at the above link.  But, whichever method works for you...
Thanks for the help:)
No problem...glad you found what you were looking for.