To what end do you need to get the type library id? The type library id
is the unique identifier for the TLB/DLL, while the CLSID is for the
individual type in the type library.
Regardless, if you want to get information about the type library, you
can call the LoadTypeLibEx function through the P/Invoke layer. You can use
this to get an instance of the ITypeLib interface in the
System.Runtime.InteropServices.ComTypes namespace.
From there, you have to call the GetLibAttr method on the ITypeLib
interface, getting an IntPtr which points to the structure in memory which
has the type library id. You will have to define the TLIBATTR structure,
and then call the static PtrToStructure method on the Marshal class to get
an instance of it (passing the IntPtr returned to you when you called
GetLibAttr).
Once you have the structure, you can access the guid property on it to
get the type library id. Also, don't forget to call ReleaseTLibAttr,
passing the IntPtr you used to get the TLIBATTR structure, so the memory can
be released.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
<na*******@gmail.comwrote in message
news:11**********************@n39g2000hsh.googlegr oups.com...
Hello!
I need to somehow extract the TypeLib ID from a COM-dll compiled using
VB6. Is is possible or do I have to look it up in the registry somehow
(ie by iterating over TypeLibIDs in HKEY_CLASSES_ROOT\TypeLib\ and
matching the DLL path info?
Please excuse any inaccuracies in this post, my understanding of COM
is patchy, especially the progid/clsid/typelib part of it.