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

GetClasses - Enumerate all the classes defined in a type library

Total Hit ( 1714)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
' Return a collection with all creatable classes of
' the type library specified in TypeLibFile.
'
' Set IncludeNotCreatableClasses = True to include not creatable classes
' (that is, those with Instancing property set to PublicNotCreatable) too.

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

Function GetClasses(ByVal TypeLibFile As String, _
  Optional ByVal IncludeNotCreatableClasses As Boolean) As Collection
  Dim TLI As New TLIApplication
  Dim TypeLibrary As TypeLibInfo
  Dim Class As CoClassInfo
  
  ' raises an error if unable to open the type library
  ' (e.g. file not found or not a TLB)
  Set TypeLibrary = TLI.TypeLibInfoFromFile(TypeLibFile)
  
  ' prepare the result
  Set GetClasses = New Collection

  ' fill the return collection with class names
  For Each Class In TypeLibrary.CoClasses
    ' exclude not creatable classes if necessary
    If IncludeNotCreatableClasses Or (Class.AttributeMask And _
      TYPEFLAG_FCANCREATE) Then
      ' the class is creatable or we don't care
      ' about the creatable attribute
      GetClasses.Add Class.Name, Class.Name
    End If
  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.