[]
        
(Showing Draft Content)

GrapeCity.Documents.DX.ComObject

Class ComObject

Namespace
GrapeCity.Documents.DX
Assembly
GcDocs.DX.Windows.dll

Root IUnknown class to interop with COM object

public class ComObject : CppObject, IDisposable, IUnknown
Inheritance
object
ComObject
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

ComObject(IntPtr)

Initializes a new instance of the ComObject class.

public ComObject(IntPtr pointer)

Parameters

pointer System.IntPtr

Pointer to Cpp Object

ComObject(object)

Initializes a new instance of the ComObject class from a IUnknown object.

public ComObject(object iunknownObject)

Parameters

iunknownObject object

Reference to a IUnknown object

Methods

As<T>(IntPtr)

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

Parameters

iunknownPtr System.IntPtr

The managed COM object.

Returns

T

An instance of the queried interface

Type Parameters

T

The type of the COM interface to query

As<T>(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>(object comObject) where T : ComObject

Parameters

comObject object

The managed COM object.

Returns

T

An instance of the queried interface

Type Parameters

T

The type of the COM interface to query

Dispose(bool)

Clean up any resources being used.

protected override void Dispose(bool disposing)

Parameters

disposing bool

EqualsComObject<T>(T, T)

Compares 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

Parameters

left T

The left.

right T

The right.

Returns

bool

true if the native pointer is the same, false otherwise

Type Parameters

T

NativePointerUpdated(IntPtr)

Method called when the NativePointer is updated.

protected override void NativePointerUpdated(IntPtr oldNativePointer)

Parameters

oldNativePointer System.IntPtr

NativePointerUpdating()

Method called when NativePointer is going to be update.

protected override void NativePointerUpdating()

QueryInterface(Guid, out IntPtr)

Query this instance for a particular COM GUID/interface support.

[CLSCompliant(false)]
public virtual void QueryInterface(Guid guid, out IntPtr outPtr)

Parameters

guid System.Guid

GUID query interface

outPtr System.IntPtr

output object associated with this GUID, IntPtr.Zero in interface is not supported

QueryInterface<T>()

Query this instance for a particular COM interface support.

public virtual T QueryInterface<T>() where T : ComObject

Returns

T

An instance of the queried interface

Type Parameters

T

The type of the COM interface to query

QueryInterface<T>(object)

Queries a managed object for a particular COM interface support.

public static T QueryInterface<T>(object comObject) where T : ComObject

Parameters

comObject object

The managed COM object.

Returns

T

An instance of the queried interface

Type Parameters

T

The type of the COM interface to query

QueryInterfaceFrom<T>(T)

Query Interface for a particular interface support and attach to the given instance.

protected void QueryInterfaceFrom<T>(T fromObject) where T : ComObject

Parameters

fromObject T

Type Parameters

T

QueryInterfaceOrNull(Guid)

Query instance for a particular COM GUID/interface support.

public virtual IntPtr QueryInterfaceOrNull(Guid guid)

Parameters

guid System.Guid

GUID query interface

Returns

System.IntPtr

QueryInterfaceOrNull<T>()

Query Interface for a particular interface support.

public virtual T QueryInterfaceOrNull<T>() where T : ComObject

Returns

T

An instance of the queried interface or null if it is not supported

Type Parameters

T

QueryInterfaceOrNull<T>(IntPtr)

Queries a managed object for a particular COM interface support.

public static T QueryInterfaceOrNull<T>(IntPtr comPointer) where T : ComObject

Parameters

comPointer System.IntPtr

A pointer to a COM object.

Returns

T

An instance of the queried interface

Type Parameters

T

The type of the COM interface to query

Operators

explicit operator ComObject(IntPtr)

Performs an explicit conversion from System.IntPtr to ComObject.

public static explicit operator ComObject(IntPtr nativePointer)

Parameters

nativePointer System.IntPtr

The native pointer.

Returns

ComObject

The result of the conversion.