小弟正在做个浏览器,然后可以添加喜欢网页的地址到下拉菜单里面。就像ie的收藏菜单和firefox的book菜单一样例如:添加收藏夹
整理收藏夹
---------------
google - http://www.google.com
我用的是control array. "-----------" 名字是 subList,index = 0.如果有新的网址加入name就是subList(1).怎样才能点击“google - http://www.google.com“这个菜单选项, 只运行依"http://"开头的网址“http://www.google.com".(包括http://)。请把代码写出来.谢谢了。

解决方案 »

  1.   

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Longurltext为你保存网址(如google - http://www.google.com)的字符串
    ShellExecute Me.hwnd, vbNullString, Right(a, Len(urltext) - InStr(1, urltext, "http://") + 1), vbNullString, App.Path, 1
      

  2.   

    Private Sub SubList_Click(Index As Integer)
    Dim listItem    'Declare a dynamic array.
            If Trim(SubList(Index).Caption) <> "" Then
                listItem = Split(SubList(Index).Caption, " - ")
                If InStr(listItem(1), "://") > 0 Then
                   WebBrowser.Navigate listItem(1)
                   Timer1.Enabled = True
                End If
            End If
    End Sub
    我这样写行不行呀??