Пример #1
0
 protected internal ComObject(IComInterface comInterface)
 {
     if (comInterface == null)
     {
         throw new ArgumentNullException(nameof(comInterface));
     }
     _comInterface = comInterface;
 }
Пример #2
0
        public static void TestComInteropNullPointers()
        {
            Console.WriteLine("Testing Marshal APIs for COM interfaces");
            IComInterface comPointer = null;
            var           result     = IsNULL(comPointer);

            ThrowIfNotEquals(true, IsNULL(comPointer), "COM interface marshalling null check failed");
        }
Пример #3
0
            public ImprovedClass()
            {
                var typeBaseIComInterface = typeof(OldLibrary.BaseClass).GetInterfaces().First((t) =>
                                                                                               t.GUID == typeof(IComInterface).GUID); // get OldLibrary.BaseClass.IComInterface

                this.unkBaseIComInterface = Marshal.GetComInterfaceForObject(this, typeBaseIComInterface, CustomQueryInterfaceMode.Ignore);

                this.unkBaseShim      = Marshal.CreateAggregatedObject(this.unkBaseIComInterface, new Inner(this.unkBaseIComInterface));
                this.baseComInterface = (IComInterface)Marshal.GetTypedObjectForIUnknown(this.unkBaseShim, typeof(IComInterface));

                ((IComInterface)this).ComMethod(this);                 // works!
            }
Пример #4
0
 static extern int BuildComPointer(out IComInterface foo);
Пример #5
0
 static extern int RetrieveCapturedComPointer(out IComInterface foo);
Пример #6
0
 static extern int CaptureComPointer(IComInterface foo);
Пример #7
0
 static extern bool IsNULL(IComInterface foo);
Пример #8
0
 public static extern void GetIComInterfaceCs([MarshalAs(UnmanagedType.Interface)] ref IComInterface <char> pValues, int count);
Пример #9
0
 public static extern void GetIComInterfaceCOut([MarshalAs(UnmanagedType.Interface)] out IComInterface <char> value);
Пример #10
0
 protected internal ComObject(IComInterface comInterface)
 {
     if (comInterface == null)
         throw new ArgumentNullException(nameof(comInterface));
     _comInterface = comInterface;
 }