- VERSION 5.00
- Begin VB.Form Form1
- AutoRedraw = -1 'True
- Caption = "Form1"
- ClientHeight = 5340
- ClientLeft = 48
- ClientTop = 336
- ClientWidth = 8424
- LinkTopic = "Form1"
- ScaleHeight = 5340
- ScaleWidth = 8424
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 372
- Left = 6240
- TabIndex = 0
- Top = 120
- Width = 972
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- Dim refTypeLibInfo As TLI.TypeLibInfo
- ' Load the type library from the registry based on the LIBID
- Set refTypeLibInfo = TLI.TLIApplication.TypeLibInfoFromRegistry("{10000003-0000-0000-0000-000000000001}", 1, 0, 0)
- Dim refCoClassInfo As TLI.CoClassInfo
- For Each refCoClassInfo In refTypeLibInfo.CoClasses
- ' Print the coclass name
- Print "Coclass: " & refCoClassInfo.Name
- ' Display info about all interfaces implemented by the coclass
- PrintInterfaces refCoClassInfo.Interfaces
- Next
- End Sub
- Sub PrintInterfaces(refInterfaces As TLI.Interfaces)
- Dim refInterfaceInfo As TLI.InterfaceInfo
- For Each refInterfaceInfo In refInterfaces
- ' Print interface name
- Print "Interface: " & refInterfaceInfo.Name;
- ' Print interface IID
- Print " " & refInterfaceInfo.Guid
- Dim refMemberInfo As TLI.MemberInfo
- For Each refMemberInfo In refInterfaceInfo.Members
- ' Print the return type
- Select Case refMemberInfo.ReturnType
- Case TliVarType.VT_HRESULT
- Print vbTab & "HRESULT ";
- Case TliVarType.VT_INT
- Print vbTab & "int ";
- Case TliVarType.VT_UI4
- Print vbTab & "ULONG ";
- End Select
- ' Print method name
- Print refMemberInfo.Name & "(";
- Dim refParameterInfo As TLI.ParameterInfo
- For Each refParameterInfo In refMemberInfo.Parameters
- ' Print parameter direction
- Select Case refParameterInfo.Flags
- Case ParamFlags.PARAMFLAG_FIN
- Print "[in] ";
- Case ParamFlags.PARAMFLAG_FOUT
- Print "[out] ";
- Case ParamFlags.PARAMFLAG_FRETVAL
- Print "[retval] ";
- End Select
- ' Print parameter type
- Select Case refParameterInfo.VarTypeInfo.VarType
- Case TliVarType.VT_INT
- Print "int ";
- Case TliVarType.VT_VOID
- Print "void ";
- End Select
- ' Print parameter name
- Print refParameterInfo.Name & ", ";
- Next
- Print ")"
- Next
- ' Recursive calls to print all base interfaces including IUnknown
- PrintInterfaces refInterfaceInfo.ImpliedInterfaces
- Next
- End Sub