遍历成员

当前位置:首页>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 Interface
    Dim oMbr As MemberInfo
    Dim oPrm As ParameterInfo
    If oInfo.Interfaces.Count Then  '有接口成员
        For i = 1 To oInfo.Interfaces.Count  '遍历接口
            Set oIfc = oInfo.Interfaces(i)
            Debug.Print oIfc.Name
            If oIfc.Members.Count Then
                For j = 1 To oIfc.Members.Count
                    Set oMbr = oIfc.Members(j)
                    Debug.Print oMbr.DispId
                    If oMbr.Parameters.Count Then
                        For k = 1 To oMbr.Parameters.Count
                            Set oPrm = oMbr.Parameters(k)
                            Debug.Print oPrm.Name
                        Next k
                    End If
                Next j
            End If
        Next i
    End If
End Sub