[]
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 System.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 System.IntPtrThe managed COM object.
An instance of the queried interface
TThe 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
TThe 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
TMethod called when the NativePointer is updated.
protected override void NativePointerUpdated(IntPtr oldNativePointer)
oldNativePointer System.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 System.GuidGUID query interface
outPtr System.IntPtroutput object associated with this GUID, IntPtr.Zero in interface is not supported
Query this instance for a particular COM interface support.
public virtual T QueryInterface<T>() where T : ComObject
An instance of the queried interface
TThe 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
TThe type of the COM interface to query
Query Interface for a particular interface support and attach to the given instance.
protected void QueryInterfaceFrom<T>(T fromObject) where T : ComObject
fromObject TTQuery instance for a particular COM GUID/interface support.
public virtual IntPtr QueryInterfaceOrNull(Guid guid)
guid System.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
TQueries a managed object for a particular COM interface support.
public static T QueryInterfaceOrNull<T>(IntPtr comPointer) where T : ComObject
comPointer System.IntPtrA pointer to a COM object.
An instance of the queried interface
TThe type of the COM interface to query
Performs an explicit conversion from System.IntPtr to ComObject.
public static explicit operator ComObject(IntPtr nativePointer)
nativePointer System.IntPtrThe native pointer.
The result of the conversion.