遍历事件

当前位置:首页>EventApp>遍历事件

遍历事件

'简单示例
Sub 遍历事件()
    Dim epp As loquatEvent.EventApp
    Set epp = CreateObject("loquat.EventApp")
    
    Dim obj As Object  '目标对象
    Set obj = CreateObject("vbscript.regexp")
    
    Dim oInfo As ObjectInfo
    Set oInfo = epp.Add("key1", obj)  '目标对象加载到EventApp里
    
    Dim i As Long, j As Long, k As Long
    
    Dim oIfc As EventInterface
    Dim oEvt As EventInfo
    Dim oPrm As ParameterInfo
    If oInfo.EventInterfaces.Count Then  '有接口成员
        For i = 1 To oInfo.EventInterfaces.Count  '遍历接口
            Set oIfc = oInfo.EventInterfaces(i)
            Debug.Print oIfc.Name
            If oIfc.Events.Count Then
                For j = 1 To oIfc.Events.Count
                    Set oEvt = oIfc.Events(j)
                    Debug.Print oEvt.Name  '这里后台功能不完整
                    If oEvt.EventParameters.Count Then
                        For k = 1 To oEvts.EventParameters.Count
                            Set oPrm = oEvts.EventParameters(k)
                            Debug.Print oPrm.Name
                        Next k
                    End If
                Next j
            End If
        Next i
    End If
    
End Sub