Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools


Click here to copy the following block
' Return all classes of the type library specified in
' TypeLibFile parameter that support a certain interface.
' the interface can be specified as an Object or through its IID

' Be sure that "TypeLib Information" type library (TlbInf32.tlb)
' is referenced in your VB project.

Function GetClassesByInterface(ByVal TypeLibFile As String, _
  ObjectOrInterfaceIID As Variant) As Collection
  Dim TLI As New TLIApplication
  Dim TypeLibrary As TypeLibInfo
  Dim Class As CoClassInfo
  Dim Interface As InterfaceInfo
  Dim IID_objInterface As String
  
  ' prepare the result
  Set GetClassesByInterface = New Collection
  
  ' raises an error if unable to open the type library
  ' (e.g. file not found or not a TLB)
  Set TypeLibrary = TLI.TypeLibInfoFromFile(TypeLibFile)
  
  ' get the IID of requested interface
  If VarType(ObjectOrInterfaceIID) = vbString Then
    IID_objInterface = ObjectOrInterfaceIID
  Else
    IID_objInterface = TLI.InterfaceInfoFromObject(ObjectOrInterfaceIID) _
      .Guid
  End If
  
  ' fill the return collection with names of
  ' classes that implement the interface
  For Each Class In TypeLibrary.CoClasses
    For Each Interface In Class.Interfaces
      ' compare GUIDs
      If StrComp(Interface.Guid, IID_objInterface, vbTextCompare) = 0 Then
        ' ok, this class implements the interface
        GetClassesByInterface.Add Class.Name, Class.Name
        Exit For
      End If
    Next
  Next
  
End Function


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.