Imports System.IO Imports System.Text Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices.ComTypes Imports System.ComponentModel Public Class Form1 Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load Dim dinf As New DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Favorites)) For Each fl In dinf.GetFiles("*.url", SearchOption.AllDirectories) ToolStripSplitButton1.DropDownItems.Add(New FavoriteMenuItem(fl, AddressOf WebBrowser1.Navigate)) Next End Sub Public Class FavoriteMenuItem Inherits ToolStripMenuItem Private Fullname As String Private url As Uri Private action As Action(Of Uri) Public Sub New(ByVal Fl As FileInfo, ByVal action As Action(Of Uri)) MyBase.New(Fl.Name.Replace(Fl.Extension, "")) Fullname = Fl.FullName Me.action = action Dim o As Object = CreateObject("InternetShortcut") DirectCast(o, IPersistFile).Load(Fl.FullName, 0) Dim sb As New System.Text.StringBuilder() Dim url As String = Nothing DirectCast(o, IUniformResourceLocatorW).GetUrl(url) Me.url = New Uri(url) Marshal.ReleaseComObject(o) AddHandler Click, AddressOf ClickFavorite End Sub Private Sub ClickFavorite(ByVal sender As Object, ByVal e As EventArgs) If action IsNot Nothing Then action(Me.url) End If End Sub <ComImport()> _ <InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ <Guid("CABB0DA0-DA57-11CF-9974-0020AFD79762")> _ Private Interface IUniformResourceLocatorW <EditorBrowsable(EditorBrowsableState.Never)> Sub _SetUrl() Sub GetUrl(<Out(), MarshalAs(UnmanagedType.LPWStr)> _ ByRef ppszURL As String) <EditorBrowsable(EditorBrowsableState.Never)> Sub _InvokeCommand() End Interface End Class End Class