public class ComObject : IUnknown, IDisposable
Represents a native COM object.
UnsafeBasePtr
Unsafe native pointer to the COM object.
protected Void* UnsafeBasePtr
ComObject()
Initializes a new instance of the ComObject class.
public void ComObject()
ComObject(IntPtr ptr)
Initializes a new instance of the ComObject class.
public void ComObject(IntPtr ptr)
Parameters
ptr
IntPtrThe native pointer of the COM object.
AddRef()
Increments the reference count for an interface on an object. This method should be called for every new copy of a pointer to an interface on an object.
none Int32 AddRef()
Returns
The method returns the new reference count. This value is intended to be used only for test purposes.
Dispose()
Releases the COM object.
public void Dispose()
Dispose(Boolean disposing)
Releases the COM object.
protected virtual void Dispose(Boolean disposing)
Parameters
disposing
BooleanTrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Finalize()
Finalizes an instance of the ComObject class.
protected void Finalize()
QueryInterface(Guid& riid, IntPtr& ppvObject)
Retrieves pointers to the supported interfaces on an object.
none Int32 QueryInterface(Guid& riid, IntPtr& ppvObject)
Parameters
riid
Guid&The identifier of the interface being requested.
ppvObject
IntPtr&The address of a pointer variable that receives the interface pointer requested in the riid parameter.
Returns
This method returns SOK if the interface is supported, and ENOINTERFACE otherwise. If ppvObject is NULL, this method returns E_POINTER.
QueryInterface(Type type)
Retrieves a pointer to the supported interface on an object.
public IntPtr QueryInterface(Type type)
Parameters
type
TypeType of the requested ComObject.
Returns
A pointer to the requested interface.
QueryInterface
Queries supported interfaces/objects on a ComObject.
public T QueryInterface<T>()
Type Parameters
T
The ComObject being requested.
Returns
The queried com interface/object.
Release()
Decrements the reference count for an interface on an object.
none Int32 Release()
Returns
The method returns the new reference count. This value is intended to be used only for test purposes.
BasePtr
Native pointer to the COM object.
public IntPtr BasePtr { get; set; }
IsDisposed
Gets a value which indicates whether the ComObject got already disposed.
public Boolean IsDisposed { get; }