# mspDestroyChannel

Destroys a specified MSPP channel.

#### Prototype

DWORD mspDestroyChannel ( MSPHD chnhd )

Argument | Description
chnhd | MSPP channel handle.

#### Return values

Return values | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | Function argument includes an invalid value or a required pointer argument is NULL.
CTAERR_INVALID_CTAHD | Handle is invalid.
CTAERR_INVALID_HANDLE | Invalid handle was passed as an argument to this function.
MSPERR_INVALID_HANDLE | Specified MSPP channel is not valid.

#### Events

Event | Description
MSPEVN_DESTROY_CHANNEL_DONE | Generated when an MSPP media channel is destroyed following an mspDestroyChannel function call. The event.value field can contain the following: CTA_REASON_FINISHED MSPRSN_FAILED_TO_DEALLOCATE MSPP service is unable to de-allocate on-board resources. MSPRSN_FAILED_TO_INTRADISCONNECT MSPP service is unable to disconnect filters within the channel. MSPRSN_FAILED_TO_INTERDISCONNECT MSPP service is unable to disconnect the channel from an endpoint. The event.objHd specifies the chnhd of the destroyed channel.

#### Details

When called, mspDestroyChannel disconnects and destroys a specified MSPP channel.

#### See also

mspCreateChannel, mspDisableChannel

#### Example

ret = mspDestroyChannel(hChan);
if (ret != SUCCESS)
return FAILURE;
// Wait for event
ctaWaitEvent( hCtaQueHd, &Event, CTA_WAIT_FOREVER );
// Check the reason code
if ( Event.id != MSPEVN_DESTROY_CHANNEL_DONE ||
Event.value != CTA_REASON_FINISHED )
return FAILURE;