# dispMakeAndQueueEvent

Creates an event and sends it to the application event queue or to the dispatcher event queue.

#### Prototype

DWORD dispMakeAndQueueEvent (CTAHD ctahd, unsigned id, unsigned value, unsigned source, unsigned destination)

Argument | Description
ctahd | Context handle returned by ctaCreateContext.
id | Event ID field of DISP_EVENT.
value | Value field of DISP_EVENT.
source | Source service identifier of the event (addr field of DISP_EVENT).
destination | Destination service identifier of the event (addr field of DISP_EVENT).

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | Function argument has an invalid value.
CTAERR_INVALID_CTAHD | Specified ctahd is invalid.
CTAERR_NOT_IMPLEMENTED | Function was called from the service interface.
CTAERR_NOT_INITIALIZED | Natural Access is not initialized.
CTAERR_OUT_OF_MEMORY | Unable to allocate memory for the queue, the driver, or the context.
CTAERR_SERVICE_NOT_AVAILABLE | Specified destination service is not available.

#### Details

dispMakeAndQueueEvent is a wrapper function for dispQueueEvent. It does the following:

- Creates a DISP_EVENT structure

- Fills in the id, value, and addr fields of the DISP_EVENT structure from the passed arguments

- Calls dispQueueEvent, which then places the event on either the application event queue or on the dispatcher event queue corresponding (based on destination) to the ctahd

source is typically the service ID. destination can be:

- A service ID

- CTA_APP_SVCID

- CTA_SYS_SVCID

dispMakeAndQueueEvent is provided to simplify sending events to other services or to the application when the events only contain an event ID and value.