[]
Root IUnknown class to interop with COM object
public class ComObject : CppObject, IDisposable, IUnknown
Initializes a new instance of the ComObject class.
public ComObject(IntPtr pointer)
pointer
IntPtrPointer to Cpp Object
Initializes a new instance of the ComObject class from a IUnknown object.
public ComObject(object iunknownObject)
iunknownObject
objectReference to a IUnknown object
Queries a managed object for a particular COM interface support (This method is a shortcut to QueryInterface(Guid, out IntPtr))
public static T As<T>(IntPtr iunknownPtr) where T : ComObject
iunknownPtr
IntPtrThe managed COM object.
An instance of the queried interface
T
The type of the COM interface to query
Queries a managed object for a particular COM interface support (This method is a shortcut to QueryInterface(Guid, out IntPtr))
public static T As<T>(object comObject) where T : ComObject
comObject
objectThe managed COM object.
An instance of the queried interface
T
The type of the COM interface to query
Clean up any resources being used.
protected override void Dispose(bool disposing)
disposing
boolCompares 2 COM objects and return true if the native pointer is the same.
public static bool EqualsComObject<T>(T left, T right) where T : ComObject
left
TThe left.
right
TThe right.
true
if the native pointer is the same, false
otherwise
T
Method called when the NativePointer is updated.
protected override void NativePointerUpdated(IntPtr oldNativePointer)
oldNativePointer
IntPtrMethod called when NativePointer is going to be update.
protected override void NativePointerUpdating()
Query this instance for a particular COM GUID/interface support.
[CLSCompliant(false)]
public virtual void QueryInterface(Guid guid, out IntPtr outPtr)
guid
GuidGUID query interface
outPtr
IntPtroutput object associated with this GUID, IntPtr.Zero in interface is not supported
Query Interface for a particular interface support and attach to the given instance.
protected void QueryInterfaceFrom<T>(T fromObject) where T : ComObject
fromObject
TT
Query instance for a particular COM GUID/interface support.
public virtual IntPtr QueryInterfaceOrNull(Guid guid)
guid
GuidGUID query interface
Query Interface for a particular interface support.
public virtual T QueryInterfaceOrNull<T>() where T : ComObject
An instance of the queried interface or null if it is not supported
T
Queries a managed object for a particular COM interface support.
public static T QueryInterfaceOrNull<T>(IntPtr comPointer) where T : ComObject
comPointer
IntPtrA pointer to a COM object.
An instance of the queried interface
T
The type of the COM interface to query
Query this instance for a particular COM interface support.
public virtual T QueryInterface<T>() where T : ComObject
An instance of the queried interface
T
The type of the COM interface to query
Queries a managed object for a particular COM interface support.
public static T QueryInterface<T>(object comObject) where T : ComObject
comObject
objectThe managed COM object.
An instance of the queried interface
T
The type of the COM interface to query
public static explicit operator ComObject(IntPtr nativePointer)
nativePointer
IntPtrThe native pointer.
The result of the conversion.