문제

In unmanaged code I can use LoadTypeLib() to obtain an ITypeLib* pointer and use that to look into the typelib to find what interfaces it contains.

There is System.Runtime.InteropServices.ComTypes.ITypeLib interface in C# but I can't find an equivalent to LoadTypeLib() function.

How do I load a typelib and obtain an ITypeLib reference in C#?

도움이 되었습니까?

해결책

Copied straight from System.Design.NativeMethods, Reflector is useful:

[DllImport("oleaut32.dll", PreserveSig=false)]
public static extern ITypeLib LoadTypeLib([In, MarshalAs(UnmanagedType.LPWStr)] string typelib);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top