问个listbox中的超连接问题..急急!

来源:百度知道 编辑:UC知道 时间:2024/05/26 16:23:39
Option Explicit

Private Sub Command1_Click()
Command1.Enabled = False
WebBrowser1.Navigate2 Text1.Text
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

Dim x As Long
List1.Clear

For x = 0 To WebBrowser1.Document.Links.length - 1
List1.AddItem WebBrowser1.Document.Links.Item(x)
Next x
Command1.Enabled = True
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Label3 = Text
End Sub

这是一个获取网页所有连接的代码,但是获取之后listbox中列出的列表连接直接点没反映,谁能说下如何把列出来的连接加上连接。

Option Explicit
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 Long

Private Sub Command1_Click()
Command1.Enabled = False
WebBrowser1.Navigate2 Text1.Text
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)

Dim x As Long
List1.Clear

For x = 0 To WebBrowser1.Document.Links.length - 1
List1.AddItem WebBrowser1.Document.Links.Item(x)
Next x
Command1.Enabled = True
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Label3 = Text
End Sub

Private Sub List1_Click()
ShellExecute hWnd, "open", List1.Text, "", "", "1"
End Sub