An ATL Project to View Type Libraries | CodeGuru

An ATL Project to View Type Libraries

Lib2Usr ATL component. Here is an ATL project for viewing all "classes" from a dll, tlb, or ocx, in fact library files. User can read some of informations, like functions(methods and properties) from a file, only if that file has a resource "TYPELIB"\1 in resource component. I use the LoadTypeLib file to provide a pointer […]

Written By
CodeGuru Staff
CodeGuru Staff
Dec 2, 1998
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Lib2Usr ATL
component.


Here is an ATL
project for viewing all "classes" from a dll, tlb, or ocx, in fact
library files. User can read some of informations, like functions(methods and
properties) from a file, only if that file has a resource "TYPELIB"\1
in resource component. I use the LoadTypeLib file to provide a pointer to a
ITypeLib interface. From the ITypeLib interface you can find all that library
know (functions, variables, names, …).


Classes and Interfaces uses
in project


ILib2Me (CLib2Me) – an interface which provides two functions: Load and
Class Load function loads the file as TypeLibrary. If the is function
successfull, then you can call funtion Class to provide one by one all interfaces,
enums, coclass, … defines in library. Function will return a pointer to an
ILClass interface.


ILClass (CLClass) – This
interface provides informations about one "class". I define
"class" to be a : enum, record, module, interface, dispatch, coclass,
alias, union or max .(kinds) User can find the name (get_Name ), kind
(get_Kind), count of functions, function (get_Function), count of variables,
variable (get_Variable) of this "class". get_Function(int nIndex)
function  returns pointer (ILFucntion*) to the function nIndex from class.
get_Variable(int nIndex) function returns pointer (ILVariable*) to the variable
nIndex from class. In both cases, functions will return NULL, if nIndex is not
found in range (0..GetCount…() – 1).


ILFunction(CLFunction)
This interface provides infromations about one function. User can find name
(get_Name), kind (get_Kind – virtual,purevirtual,nonvirtual,static,dispatch),
invoke kind (get_InvokeKind – function(1), get(2), put(4),putref(8)),
documentation (get_Documentation), ID (get_ID), parameters and return type. If
you want one of the function’s parameter, wou have to call get_Parameter
function. You have to pass the index of parameter, and this parameter will
return the pointer to one parameter interface (ILParameter*).


ILVariable(CLVariable) –
This interface provides informations, like name, type and kind
(persistance, static, const or dispatch) of one variable.


ILParameter(CLParameter)
This interface wil return informations such name (get_Name, and type (get_Type),
of one parameter.

DEMO program And Source(Updated)

Now one can even watch interfaces of a particular object. Demo application in VC++ included.

This is how DEMO VB program looks like :-

A new DEMO program has been added in VC++

Download demo VB project – 10 KB

Download demo VC project – 10 KB

Download source – 54 KB

The demo project VB requires XPropertiesWnd ActiveX control. See
A set of two activeX controls article.

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.