How to read COM TypeLib with C# or C++?
See the question and my original answer on StackOverflowThe official API is available here: Type Description Interfaces.
You can use it from C++ directly but I suggest you use .NET (C# in my sample) with an extra tool that Microsoft has written long time ago (mine is dated 1997), named TLBINF32.DLL. It's also a COM object but is Automation (VBScript, Javascript, VB/VBA) and .NET compatible.
You can find TLBINF32.DLL googling for it (this link seems to work today: tlbinf32.dll download, make sure you get the .ZIP file, not what they call the "fixer"...). Note it's a 32-bit DLL so your program must be compiled as 32-bit to be able to use it. I don't know of any 64-bit version but how to use it a with 64-bit client is described here: tlbinf32.dll in a 64bits .Net application
How to use this library is explained in detail here in this december 2000 MSDN magazine's article: Inspect COM Components Using the TypeLib Information Object Library. It's VB (not .NET) oriented, but it's quite easy to translate in .NET terms.
Here is a sample console app in C# that just dumps all type info from a type lib (here MSHTML.TLB):
class Program
{
static void Main(string[] args)
{
TypeLibInfo tli = new TypeLibInfo();
tli.ContainingFile = @"c:\windows\system32\mshtml.tlb";
foreach (TypeInfo ti in tli.TypeInfos)
{
Console.WriteLine(ti.Name);
// etc...
}
}
}