vb如何获取当前IE中打开的网页源代码?
vb如何获取当前IE中打开的网页源代码,最好是自动监测新打开的网页并获取源代码能解决我的问题,我再送70分。...
vb如何获取当前IE中打开的网页源代码,最好是自动监测新打开的网页并获取源代码
能解决我的问题,我再送70分。 展开
能解决我的问题,我再送70分。 展开
10个回答
展开全部
在窗体内加入控件text1(Multiline=true,scrollbars=2),timer1(interval=1000),
然后在代码区复制下面代码,
运行,即可在text1内实时显示当前IE中打开的网页源代码:
Option Explicit
Dim oShellApp, oShellAppWindows, oWin
Dim UrlLst As String
Private Sub Timer1_Timer()
Set oShellApp = CreateObject("Shell.Application")
Set oShellAppWindows = oShellApp.Windows
For Each oWin In oShellAppWindows
If LCase(TypeName(oWin.document)) = "htmldocument" Then
If InStr(1, UrlLst, oWin.locationurl, vbTextCompare) = 0 Then
UrlLst = UrlLst & oWin.locationurl & ","
Text1.Text = oWin.document.body.innerHTML
Me.Caption = oWin.locationname
End If
End If
Next
End Sub
然后在代码区复制下面代码,
运行,即可在text1内实时显示当前IE中打开的网页源代码:
Option Explicit
Dim oShellApp, oShellAppWindows, oWin
Dim UrlLst As String
Private Sub Timer1_Timer()
Set oShellApp = CreateObject("Shell.Application")
Set oShellAppWindows = oShellApp.Windows
For Each oWin In oShellAppWindows
If LCase(TypeName(oWin.document)) = "htmldocument" Then
If InStr(1, UrlLst, oWin.locationurl, vbTextCompare) = 0 Then
UrlLst = UrlLst & oWin.locationurl & ","
Text1.Text = oWin.document.body.innerHTML
Me.Caption = oWin.locationname
End If
End If
Next
End Sub
展开全部
30分我只能告诉你各简单的方法,把网页另存为,再用记事本打开。。。哈哈
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim url
Private Sub Timer1_Timer()
Dim oShellApp, oShellAppWindows, oWin
Set oShellApp = CreateObject("Shell.Application")
Set oShellAppWindows = oShellApp.Windows
For Each oWin In oShellAppWindows
If LCase(TypeName(oWin.Document)) = "htmldocument" Then
If url <> oWin.LocationURL Then
MsgBox oWin.Document.body.innertext
url = oWin.LocationURL
End If
End If
Next
End Sub
Private Sub Timer1_Timer()
Dim oShellApp, oShellAppWindows, oWin
Set oShellApp = CreateObject("Shell.Application")
Set oShellAppWindows = oShellApp.Windows
For Each oWin In oShellAppWindows
If LCase(TypeName(oWin.Document)) = "htmldocument" Then
If url <> oWin.LocationURL Then
MsgBox oWin.Document.body.innertext
url = oWin.LocationURL
End If
End If
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
30分太少。再加130分!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询