怎么有VB编程实现获取IE浏览器弹出窗口中的内容
怎么有VB编程实现获取IE浏览器弹出窗口中的内容比如我想获得弹出窗口中的那段文字然后用IF语句进行判断,如果弹出了那个窗口就进行下一步如果没弹出就进行另一部怎么实现?有更...
怎么有VB编程实现获取IE浏览器弹出窗口中的内容比如 我想获得弹出窗口中的那段文字然后用IF语句进行判断,如果弹出了那个窗口就进行下一步如果没弹出就进行另一部怎么实现?有更好的办法也可一说出来
展开
3个回答
推荐于2017-12-16
展开全部
能的 Dim dWinFolder As New ShellWindows
Dim WithEvents eventIE As WebBrowser_V1
Private Sub Command1_Click()
Dim objIE As Object
For Each objIE In dWinFolder
If objIE.LocationURL = List1.List(List1.ListIndex) Then
Set eventIE = objIE
Command1.Enabled = False
List1.Enabled = False
Text1.Text = ""
Exit For
End If
Next
End Sub
Private Sub eventIE_NavigateComplete(ByVal URL As String)
Text1.Text = Text1.Text + Chr(13) + Chr(10) + URL
End Sub
在运行前。点击菜单 Projects ¦ References 项,在Available References 列表中选择Microsoft Internet Controls项将Internet对象引用介入到工程中
Private Sub Form_Load()
Dim objIE As Object
For Each objIE In dWinFolder
If InStr(1, objIE.FullName, "IEXPLORE.EXE", vbTextCompare) <> 0 Then
List1.AddItem objIE.LocationURL
End If
Next
Command1.Caption = "正文"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set dWinFolder = Nothing
End Sub
Private Sub List1_Click()
Dim objDoc As Object
Dim objIE As Object
For Each objIE In dWinFolder
If objIE.LocationURL = List1.List(List1.ListIndex) Then
Set objDoc = objIE.Document
For i = 1 To objDoc.All.length - 1
If objDoc.All(i).tagname = "BODY" Then
Text1.Text = objDoc.All(i).innerText
End If
Next
Exit For
End If
Next
End Sub
Dim WithEvents eventIE As WebBrowser_V1
Private Sub Command1_Click()
Dim objIE As Object
For Each objIE In dWinFolder
If objIE.LocationURL = List1.List(List1.ListIndex) Then
Set eventIE = objIE
Command1.Enabled = False
List1.Enabled = False
Text1.Text = ""
Exit For
End If
Next
End Sub
Private Sub eventIE_NavigateComplete(ByVal URL As String)
Text1.Text = Text1.Text + Chr(13) + Chr(10) + URL
End Sub
在运行前。点击菜单 Projects ¦ References 项,在Available References 列表中选择Microsoft Internet Controls项将Internet对象引用介入到工程中
Private Sub Form_Load()
Dim objIE As Object
For Each objIE In dWinFolder
If InStr(1, objIE.FullName, "IEXPLORE.EXE", vbTextCompare) <> 0 Then
List1.AddItem objIE.LocationURL
End If
Next
Command1.Caption = "正文"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set dWinFolder = Nothing
End Sub
Private Sub List1_Click()
Dim objDoc As Object
Dim objIE As Object
For Each objIE In dWinFolder
If objIE.LocationURL = List1.List(List1.ListIndex) Then
Set objDoc = objIE.Document
For i = 1 To objDoc.All.length - 1
If objDoc.All(i).tagname = "BODY" Then
Text1.Text = objDoc.All(i).innerText
End If
Next
Exit For
End If
Next
End Sub
2013-06-04
展开全部
通过API函数获取窗口句柄。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-06-04
展开全部
VB办不到吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询