【发布时间】:2014-03-27 11:14:54
【问题描述】:
所以我有这个加载页面的表单,加载页面后我想将源插入 RichTextBox1.Text
但是在页面加载后程序崩溃(?)并给我这个错误
“Awesomium.Windows.Forms.dll 中发生了“System.AccessViolationException”类型的未处理异常
附加信息:试图读取或写入受保护的内存。这通常表明其他内存已损坏。”
这是我的代码,值得一提的是,我为此使用了 awesomium!
Public Class Form1
Dim Thread As System.Threading.Thread
Dim html_source_code As String = ""
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
Thread = New System.Threading.Thread(AddressOf Load_Page)
Thread.Start()
End Sub
Private Sub Load_Page()
While html_source_code = ""
If WebControl1.IsDocumentReady Then
html_source_code = WebControl1.ExecuteJavascriptWithResult("document.documentElement.outerHTML").ToString()
RichTextBox1.Text = html_source_code
End If
End While
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Thread = New System.Threading.Thread(AddressOf Load_Page)
Thread.Start()
End Sub
End Class
提前致谢!
【问题讨论】:
标签: vb.net multithreading awesomium