本文整理汇总了C#中System.Runtime.InteropServices.TypeLibConverter.ConvertTypeLibToAssembly方法的典型用法代码示例。如果您正苦于以下问题:C# TypeLibConverter.ConvertTypeLibToAssembly方法的具体用法?C# TypeLibConverter.ConvertTypeLibToAssembly怎么用?C# TypeLibConverter.ConvertTypeLibToAssembly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了TypeLibConverter.ConvertTypeLibToAssembly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DllImport
//引入命名空间
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
public class App
{
private enum RegKind
{
RegKind_Default = 0,
RegKind_Register = 1,
RegKind_None = 2
}
[ DllImport( "oleaut32.dll", CharSet = CharSet.Unicode, PreserveSig = false )]
private static extern void LoadTypeLibEx( String strTypeLibName, RegKind regKind,
[ MarshalAs( UnmanagedType.Interface )] out Object typeLib );
public static void Main()
{
Object typeLib;
LoadTypeLibEx( "SHDocVw.dll", RegKind.RegKind_None, out typeLib );
if( typeLib == null )
{
Console.WriteLine( "LoadTypeLibEx failed." );
return;
}
TypeLibConverter converter = new TypeLibConverter();
ConversionEventHandler eventHandler = new ConversionEventHandler();
AssemblyBuilder asm = converter.ConvertTypeLibToAssembly( typeLib, "ExplorerLib.dll", 0, eventHandler, null, null, null, null );
asm.Save( "ExplorerLib.dll" );
}
}
public class ConversionEventHandler : ITypeLibImporterNotifySink
{
public void ReportEvent( ImporterEventKind eventKind, int eventCode, string eventMsg )
{
// handle warning event here...
}
public Assembly ResolveRef( object typeLib )
{
// resolve reference here and return a correct assembly...
return null;
}
}
开发者ID:.NET开发者,项目名称:System.Runtime.InteropServices,代码行数:50,代码来源:TypeLibConverter.ConvertTypeLibToAssembly