Main > Knowledge Base > 1C:Enterprise documentation > Add-in Development Technology > Creating add-ins with COM technology > COM interfaces of 1C:Enterprise > External events > 1C:Enterprise documentation > Add-in Development Technology > Creating add-ins with COM technology > COM interfaces of 1C:Enterprise > External events > 1C:Enterprise documentation > Add-in Development Technology > Creating add-ins with COM technology > COM interfaces of 1C:Enterprise > External events

External events

When an asynchronous event is fired (for example, barcode reading), an object can use the IAsyncEvent interface for creating an external event in 1C:Enterprise. The IAsyncEvent interface inherits from IUnknown. All events are queued and processed in the order they are added. The number of stored events is limited to the queue size. During the initialization, the queue size is set to 1 and then it can be changed by calling the SetEventBufferDepth() method and retrieved using the GetEventBufferDepth() method. A separate queue is maintained for each add-in object. External event processing is performed using the predefined ExternEventProcessing() procedure and external event handlers in form modules.

SetEventBufferDepth

Description:

Sets the event queue size for an object. If the number of events in the queue exceeds the queue size, the latest events are deleted.

Syntax:

HRESULT SetEventBufferDepth(long lDepth);

Parameters:

lDepth

Type: long. The event queue size.

Return value:

GetEventBufferDepth

Description:

Stores the event queue size of the specified object to the plDepth variable.

Syntax:

HRESULT GetEventBufferDepth(long* plDepth);

Parameters:

plDepth

Type: long*. Pointer to the variable that will contain the event queue size.

Return value:

ExternalEvent

Description:

Adds an event to the queue, storing the event source, name, and parameters. During event processing, that data is passed to the ExternEventProcessing() procedure. Once the ExternalEvent() method is called, the event processing is performed as follows:

  1. The event is stored to the event queue (if the queue is full, the event is lost).

  2. If no system events are available and the queue is not empty, the first event is taken from the queue.

  3. External event processing is started.

This procedure is repeated for all add-in objects, so that external event processing is synchronized with system event processing.

Syntax:

HRESULT ExternalEvent(BSTR bstrWho, BSTR bstrWhat, BSTR bstrData);

Parameters:

bstrWho

Type: BSTR. A string that contains the event source.

bstrWhat

Type: BSTR. A string that contains the event name.

bstrData

Type: BSTR. A string that contains the event parameters.

Return value:

CleanBuffer

Description:

Clears the event queue by deleting all events from the queue.

Syntax:

HRESULT CleanBuffer();

Return value:

Next page: Status bar operations




© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.