S
Some Developer
Assume there is a COM server on the system which exposes
an object with the interface below. GetBuffer() will
fill a buffer of several different types... and its a
pain to have to allocate an unmanaged buffer and marshal
each one manually. Isn't there a way to indicate
overrides for methods? I tried just adding the method
definitions and setting a DispId, but the DispId has no
effect with ComImport, and the order of methods confuses
COM/.NET (.NET sees that as three different distinct
methods).
The only solution I've found was to redefine the entire
interface and make custom method definitions for each
interface... but the interface is actually *MUCH* larger
than the one below... plus its a pain to have two
different names for each interface override.
Any input would be appreciated.
[ComImport, Guid("9473974-some-guid-124359")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITestInterface
{
[DispId(1)]
void GetBuffer(
[Out] out Guid guid);
[DispId(1)]
void GetBuffer(
[Out] out CustomStructure data);
[DispId(1)]
void GetBuffer(
[In, Out] IntPtr buffer);
}
an object with the interface below. GetBuffer() will
fill a buffer of several different types... and its a
pain to have to allocate an unmanaged buffer and marshal
each one manually. Isn't there a way to indicate
overrides for methods? I tried just adding the method
definitions and setting a DispId, but the DispId has no
effect with ComImport, and the order of methods confuses
COM/.NET (.NET sees that as three different distinct
methods).
The only solution I've found was to redefine the entire
interface and make custom method definitions for each
interface... but the interface is actually *MUCH* larger
than the one below... plus its a pain to have two
different names for each interface override.
Any input would be appreciated.
[ComImport, Guid("9473974-some-guid-124359")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITestInterface
{
[DispId(1)]
void GetBuffer(
[Out] out Guid guid);
[DispId(1)]
void GetBuffer(
[Out] out CustomStructure data);
[DispId(1)]
void GetBuffer(
[In, Out] IntPtr buffer);
}