How to load type library file in MSFT format using LoadTypeLibEx

0

I have an old OLB file that actually is a type library (probably MSFT file format). It´s signature starts with 0x4D, 0x53, 0x46, 0x54, 0x02, 0x00, 0x01, 0x00 which is an OLE Type Libary 2, or C++ type library file, as I learned so far.

I am trying to load that file using the LoadTypeLibEx method in a C# application (a simple library viewer that can explore type libraries without registering) in order to get an ITypLib object that I can use to reflect all types and members defined by the library, but the function call fails with the following error:

System.Runtime.InteropServices.COMException Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))

Loading type libraries from other library files that do have signatures such as 0x4D, 0x5A, or 0x53, 0x4C, 0x54, 0x47 work just fine. So, I would like to know if LoadTypeLibEx is able to read MSFT files, or what needs to be done to extract the type library that seems to be embedded into it.

c#
com
interop
typelib
asked on Stack Overflow Dec 5, 2018 by Matze

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0