首页 > 代码库 > vb6 webbrowser 事件捕获
vb6 webbrowser 事件捕获
Private WithEvents htmlDocument As htmlDocumentPrivate WithEvents btnCompute As MSHTML.HTMLButtonElementPrivate WithEvents txtNum1 As MSHTML.HTMLInputTextElementPrivate WithEvents txtNum2 As MSHTML.HTMLInputTextElementPrivate WithEvents txtResult As MSHTML.HTMLInputTextElementPrivate Function btnCompute_onclick() As Boolean On Error GoTo ErrHandler: txtResult.Value = CDbl(txtNum1.Value) + CDbl(txtNum2.Value) Exit FunctionErrHandler: MsgBox Err.DescriptionEnd FunctionPrivate Sub Command1_Click() Text1.Visible = Not Text1.VisibleEnd SubPrivate Sub Form_Load() WebBrowser1.Navigate "about:blank" Do While WebBrowser1.Busy Or WebBrowser1.ReadyState <> READYSTATE_COMPLETE DoEvents Loop WebBrowser1.Document.write Text1.Text Do While WebBrowser1.Busy Or WebBrowser1.ReadyState <> READYSTATE_COMPLETE DoEvents Loop Set htmlDocument = WebBrowser1.Document Set btnCompute = htmlDocument.getElementById("btnCompute") Set txtNum1 = htmlDocument.getElementById("txtNum1") Set txtNum2 = htmlDocument.getElementById("txtNum2") Set txtResult = htmlDocument.getElementById("txtResult")End SubPrivate Function htmlDocument_onclick() As Boolean Debug.Print "触发了元素" & htmlDocument.parentWindow.event.srcElement.id & "的" & htmlDocument.parentWindow.event.Type & "事件"End Function
vb6 webbrowser 事件捕获
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。