Table of Contents

Class DispatchEventSink

Namespace
CsCom.Runtime
Assembly
CsCom.Runtime.dll

An event sink for dispinterfaces: a COM object that implements IDispatch, also under the identifier of the dispinterface, and passes the invocations to an IDispatchEventHandler until the gate of its connection is closed.

[GeneratedComClass]
[ComExposedClass<ComClassInformation>]
public sealed class DispatchEventSink : IDispatch
Inheritance
DispatchEventSink
Implements
Inherited Members
Extension Methods

Methods

InvokeHandler(EventGate, IDispatchEventHandler, int, DispParams*, ComVariant*, ExcepInfo*)

Passes an invocation of IDispatch::Invoke to a handler while the gate of the connection is open, as a sink does that is created with Advise(object, Guid, Func<EventGate, object>) and implements IDispatch, e.g. for a dual event interface. A closed gate accepts the invocation without passing it on, whatever its dispatch identifier, since the handler is not asked which events it knows any more, like a vtable sink accepts every call: the result, if the caller expects one, is empty.

public static int InvokeHandler(EventGate gate, IDispatchEventHandler handler, int dispId, DispParams* parameters, ComVariant* result, ExcepInfo* excepInfo)

Parameters

gate EventGate

The gate of the connection of the sink.

handler IDispatchEventHandler

The handler.

dispId int

The dispatch identifier of the member.

parameters DispParams*

The arguments.

result ComVariant*

The variable that receives the result, if any.

excepInfo ExcepInfo*

The structure that receives the error information, if any.

Returns

int

The HRESULT of the invocation; S_OK when the gate is closed, also for an unknown member.

Remarks

The last invocation that exits a closed gate runs the completions of DisposeWithCompletion(Action): their exception is returned like an exception of the handler, instead of the result of the handler, also when the handler failed, as a finally block would throw it.

Exceptions

ArgumentNullException

gate or handler is null, also when the gate is closed.

InvokeHandler(IDispatchEventHandler, int, DispParams*, ComVariant*, ExcepInfo*)

Passes an invocation of IDispatch::Invoke to a handler. An exception thrown by the handler is returned as DISP_E_EXCEPTION with the error information, or as its HResult when the caller expects none; as E_FAIL when that is no error code.

public static int InvokeHandler(IDispatchEventHandler handler, int dispId, DispParams* parameters, ComVariant* result, ExcepInfo* excepInfo)

Parameters

handler IDispatchEventHandler

The handler.

dispId int

The dispatch identifier of the member.

parameters DispParams*

The arguments.

result ComVariant*

The variable that receives the result, if any.

excepInfo ExcepInfo*

The structure that receives the error information, if any.

Returns

int

The HRESULT of the invocation.

Exceptions

ArgumentNullException

handler is null.