IUnKnown接口定义
[ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("00000000-0000-0000-C000-000000000046")]
public interface IUnknown
{
[PreserveSig]
int QueryInterface(ref Guid riid, out IntPtr ppvObject);
[PreserveSig]
uint AddRef();
[PreserveSig]
uint Release();
}
Class1定义
class Class1 : IUnknown
{
public int QueryInterface(ref Guid riid, out IntPtr ppvObject)
{
throw new Exception("The method or operation is not implemented.");
}
public uint AddRef()
{
throw new Exception("The method or operation is not implemented.");
}
public uint Release(
{
throw new Exception("The method or operation is not implemented.");
}
}
或者
class Class1 : IUnknown
{
int IUnknown.QueryInterface(ref Guid riid, out IntPtr ppvObject)
{
throw new Exception("The m