Vb.net Autoscroll Internet Explorer
我不是在使用WebBrowser控件,我是在尝试获取变量中的IE过程,以便对其进行控制 我的目标是在需要时自动向下滚动页面。以下是关于如何使用代码启动IE的更多信息:Vb.net Autoscroll Internet Explorer,vb.net,internet-explorer,autoscroll,Vb.net,Internet Explorer,Autoscroll,我不是在使用WebBrowser控件,我是在尝试获取变量中的IE过程,以便对其进行控制 我的目标是在需要时自动向下滚动页面。以下是关于如何使用代码启动IE的更多信息: Dim IE As SHDocVw.InternetExplorer IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.Navigate("C:\rptStatusProd.xml") 'load web
Dim IE As SHDocVw.InternetExplorer
IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate("C:\rptStatusProd.xml") 'load web page google.com
While IE.Busy
Application.DoEvents() 'wait until IE is done loading page.
End While
IE.FullScreen = True
但这并不能让我控制。。。有没有办法让我可以向下滚动页面?我想自动向上/向下滚动页面,因为整个公司电视都会显示一个网页,如果网页上的数据太多,它必须向下滚动才能查看。这不太好。。。但这很重要。它将滚动到页面顶部,然后向下滚动到底部。我很幸运,因为我的网页中不可能有足够的项目来显示中间的内容。这对我很有用:
Imports mshtml
Sub Main()
Dim IE As SHDocVw.InternetExplorer
IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate("C:\rptStatusProd.xml") 'load web page
While IE.Busy
Application.DoEvents() 'wait until IE is done loading page.
End While
IE.FullScreen = True
Dim doc As HTMLDocumentClass = IE.Document
Dim myProcesses() As Process
myProcesses = Process.GetProcessesByName("iexplore")
While myProcesses.Count > 0
Try
doc.activeElement.scrollIntoView(True) 'Scroll to top
System.Threading.Thread.Sleep(5000)
doc.activeElement.scrollIntoView(False) 'Scroll to bottom
System.Threading.Thread.Sleep(5000)
Catch COMEx As System.Runtime.InteropServices.COMException
'RPC Server unavailable, Internet explorer was closed
Catch ex As Exception
MsgBox(ex.Message)
End Try
End While
End Sub