本帖最后由 bcrun 于 2010-09-27 11:52:49 编辑

解决方案 »

  1.   

    看看
    http://www.vbforums.com/showthread.php?t=372811
      

  2.   

    HTML中控件事件非常简单,可以直接写在document事件里,比如:Option ExplicitDim WithEvents doc As HTMLDocumentPrivate Function doc_onclick() As Boolean
        Dim objButton As IHTMLElement
        
        On Error Resume Next
        doc_onclick = True
        Set objButton = doc.parentWindow.event.srcElement
        If LCase(objButton.tagName) <> "input" Then Exit Function
        If LCase(objButton.Type) <> "button" Then Exit Function
        If Err.Number <> 0 Then Exit Function
        
        Debug.Print "按钮" & objButton.Value & "被点击了"
    End FunctionPrivate Sub Form_Load()
        Me.WebBrowser1.Navigate2 "e:/temp.html"
    End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
        If Not pDisp Is Me.WebBrowser1.Object Then Exit Sub
        
        Set doc = Me.WebBrowser1.document
    End Sub
      

  3.   

    嗯,不错。以前用过类似的方法来实现“delegate",而且多个不同类可以共享同一事件处理过程。