如何加载typelib以在C#中进行解析? [英] How do I load a typelib to parse it in C#?
本文介绍了如何加载typelib以在C#中进行解析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在非托管代码中,我可以使用LoadTypeLib()
获取ITypeLib*
指针,并使用该指针查看typelib以查找其包含的接口.
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.
C#中有System.Runtime.InteropServices.ComTypes.ITypeLib
接口,但找不到与LoadTypeLib()
函数等效的接口.
There is System.Runtime.InteropServices.ComTypes.ITypeLib
interface in C# but I can't find an equivalent to LoadTypeLib()
function.
如何在C#中加载typelib并获取ITypeLib
引用?
How do I load a typelib and obtain an ITypeLib
reference in C#?
推荐答案
Reflector直接从System.Design.NativeMethods复制,非常有用:
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);
这篇关于如何加载typelib以在C#中进行解析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文