在我的应用程序中,我只有一个 webbrowser 和几个计时器,但如果 webbrowser 正在加载,它会使用 50% 的 CPU 和 5 分钟左右的 120k RAM。我能做些什么?
我的代码:
Public Sub work()
WebBrowser1.Navigate("Site")
tim.Start()
End Sub
Public Sub work2()
WebBrowser1.Document.GetElementFromPoint(point).InvokeMember("click")
tim2.Start()
tim.Stop()
End Sub
Dim point As New Point(800, 30)
Dim WithEvents tim As New Timer
Dim WithEvents tim2 As New Timer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tim.Interval = 6000
tim2.Interval = 6000
work()
End Sub
Private Sub tim_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tim.Tick
work2()
End Sub
Private Sub tim2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tim2.Tick
work()
End Sub