Jump to content

MCI_DEFAULT_CONNECTION

From EDM2

This message is used to make, break, and query default connections between devices.

Syntax

param1
ULONG ulParam1; /* Flags for default connection operation. */

param2
PMCI_DEFAULT_CONNECTION_PARMS pParam2; /* Pointer to the MCI_DEFAULT_CONNECTION_PARMS data structure. */

Parameters

ulParam1 (ULONG) - input
This parameter can contain any of the following flags:
  • MCI_NOTIFY A notification message will be posted to the window specified in the hwndCallback parameter of the data structure pointed to by the pParam2 parameter. The notification will be posted when the action indicated by this message is completed or when an error occurs.
  • MCI_WAIT Control is not to be returned until the action indicated by this message is completed or an error occurs.
  • MCI_QUERY_CONNECTION This flag specifies that the default connection associated with the indicated connector is to be returned in the pszToDevice, ulToConnectorType, and ulToConnectorIndex fields of the MCI_DEFAULT_CONNECTION_PARMS data structure.
  • MCI_MAKE_CONNECTION This flag specifies that a default connection is to be established between the current device and the ulDeviceTypeID field of the data structure pointed to by pParam2. The precise connectors on each device can be indicated using the associated connector type and index flags.
  • MCI_BREAK_CONNECTION This flag specifies that the default connection associated with the indicated connector is to be broken.
  • MCI_CONNECTOR_TYPE This flag specifies that the connector type (ulConnectorType field) for the primary device is to be used for the query. When this flag is used the ulConnectorIndex field is used as a relative index rather than an absolute index.
  • MCI_CONNECTOR_INDEX This flag specifies that the ulConnectorIndex field contains the connector index for the primary device. If this flag is not specified an index of 1 is assumed.
  • MCI_TO_CONNECTOR_TYPE This flag specifies that the connector type (ulToConnectorType field) for the primary device is to be used for the query. When this flag is used, the ulToConnectorIndex field is used as a relative index rather than an absolute index.
  • MCI_TO_CONNECTOR_INDEX This flag specifies that the ulToConnectorIndex field contains the connector index for the primary device. If this flag is not specified an index of 1 is assumed.
pParam2 (PMCI_DEFAULT_CONNECTION_PARMS) - input
A pointer to the MCI_DEFAULT_CONNECTION_PARMS data structure.

Returns

rc (ULONG) - returns
Return codes indicating success or type of failure:
  • MCIERR_SUCCESS If the function succeeds, 0 is returned.
  • MCIERR_INSTANCE_INACTIVE The device ID is currently inactive. Issue MCI_ACQUIREDEVICE to make the device instance active.
  • MCIERR_MISSING_FLAG A required flag is missing.
  • MCIERR_DRIVER Internal MMPM/2 driver error.
  • MCIERR_UNSUPPORTED_FLAG Given flag is unsupported for this device.
  • MCIERR_INVALID_CALLBACK_HANDLE Given callback handle is invalid.
  • MCIERR_UNSUPPORTED_CONN_TYPE This device does not support the given connector type.
  • MCIERR_INVALID_CONNECTOR_TYPE The given connector type is invalid.
  • MCIERR_INVALID_CONNECTOR_INDEX Invalid connector index given.
  • MCIERR_MISSING_PARAMETER Required parameter is missing.
  • MCIERR_INVALID_FLAG Flag is invalid (ulParam1).
  • MCIERR_FLAGS_NOT_COMPATIBLE Flags cannot be used together.
  • MCIERR_INVALID_CONNECTION An attempt was made to make an invalid connection.
  • MCIERR_NO_CONNECTION An attempt was made to break a nonexistent connection.
  • MCIERR_INVALID_DEVICE_ID A device ID is not valid.
  • MCIERR_INVALID_DEVICE_ORDINAL Invalid device ordinal given.

Remarks

Connector indexes start at index value 1. This message does not require a device to be opened.

For a list of connector types which are supported by various device types, see the MCI_CONNECTORINFO message.

Default Processing

If MCI_CONNECTOR_INDEX or MCI_TO_CONNECTOR flags are not specified, the associated connector index defaults to 1.

If MCI_CONNECTOR_TYPE or MCI_TO_CONNECTOR_TYPE flags are not specified, then the associated indexes are absolute.

Example Code

   MCI_DEFAULT_CONNECTION_PARMS    defaultconnparms;

   defaultconnparms.ulConnectorType = MCI_WAVE_STREAM_CONNECTOR;
   defaultconnparms.pszDevice = MCI_DEVTYPE_WAVEFORM_AUDIO_NAME;

                     /* Determine the default connection for waveaudio */

   mciSendCommand ( 0,                   /* Ignore field               */
      MCI_DEFAULT_CONNECTION,            /* Default connection message */
      MCI_QUERY_CONNECTION | MCI_CONNECTOR_TYPE | MCI_WAIT,
                                         /* Flags for this message     */
      (PVOID) &defaultconnparms,         /* Data structure             */
      0 );                               /* No user parm               */

    /* Note: defaultconnparms.pszToDevice now contains the name of
       the device with default connection to the waveaudio (ampmixNN). */

Related Methods