Initializes a device or device element. All devices respond to this message. The parameters and flags available for this message depend on the selected device. MMSYSTEM translates this message to the DRV_OPEN and MCI_OPEN_DRIVER messages sent to the device driver.
MCIERR_CANNOT_LOAD_DRIVER | Error loading media device driver. |
MCIERR_DEVICE_OPEN | The device name is in use by this task. Use a unique alias. |
MCIERR_DUPLICATE_ALIAS | The specified alias is an open device in this task. |
MCIERR_EXTENSION_NOT_FOUND | Cannot deduce a device type from the given extension. |
MCIERR_FILENAME_REQUIRED | A valid filename is required. |
MCIERR_MISSING_PARAMETER | Required parameter is missing. |
MCIERR_MUST_USE_SHAREABLE | The device is already open; use the shareable flag with each open. |
MCIERR_NO_ELEMENT_ALLOWED | An element name cannot be used with this device. |
MCI_NOTIFY | Specifies that MCI should post the MM_MCINOTIFY message when this command completes. The window to receive this message is specified in the dwCallback member of the structure identified by lpOpen. |
MCI_WAIT | Specifies that the open operation should finish before MCI returns control to the application. |
MCI_OPEN_ALIAS | Specifies that an alias is included in the lpstrAlias member of the structure identified by lpOpen. |
MCI_OPEN_SHAREABLE | Specifies that the device or device element should be opened as shareable. |
MCI_OPEN_TYPE | Specifies that a device type name or constant is included in the lpstrDeviceType member of the structure identified by lpOpen. |
MCI_OPEN_TYPE_ID | Specifies that the low-order word of the lpstrDeviceType member of the associated structure contains a standard MCI device type ID and the high-order word optionally contains the ordinal index for the device. Use this flag with the MCI_OPEN_TYPE flag. |
DWORD lParam1 | The following additional flags apply to compound devices: |
MCI_OPEN_ELEMENT | Specifies that an element name is included in the lpstrElementName member of the structure identified by lParam2. |
MCI_OPEN_ELEMENT_ID | Specifies that the lpstrElementName member of the structure identified by lParam2 is interpreted as a DWORD and has meaning internal to the device. Use this flag with the MCI_OPEN_ELEMENT flag. |
LPMCI_OPEN_PARMS lParam2 | Specifies a far pointer to the MCI_OPEN_PARMS structure. (Devices with additional parameters might replace this structure with a device-specific structure.) |
The following flags for lParam1apply to animation devices:
MCI_ANIM_OPEN_NOSTATIC | Specifies that the device should reduce the number of static (system) colors in the palette to two. |
MCI_ANIM_OPEN_PARENT | Indicates the parent window handle is specified in the hWndParent member of the structure identified by lParam2. The parent window handle is required for some window styles. |
MCI_ANIM_OPEN_WS | Indicates a window style is specified in the dwStyle member of the structure identified by lParam2. The dwStyle value specifies the style of the window that the driver will create and display if the application does not provide one. The style parameter takes an integer which defines the window style. These constants are the same as the ones in WINDOWS.H (such as WS_CHILD, WS_OVERLAPPEDWINDOW, or WS_POPUP). |
Note that lParam2 specifies a far pointer to the MCI_ANIM_OPEN_PARMS structure.
The following flags for lParam1 apply to video overlay devices:
MCI_OVLY_OPEN_PARENT | Indicates the parent window handle is specified in the hWndParent member of the structure identified by lParam2. |
MCI_OVLY_OPEN_WS | Indicates a window style is specified in the dwStyle member of the structure identified by lParam2. The dwStyle value specifies the style of the window that the driver will create and display if the application does not provide one. The style parameter takes an integer that defines the window style. These constants are the same as those in WINDOWS.H (for example, WS_CHILD, WS_OVERLAPPEDWINDOW, or WS_POPUP). |
Note that lParam2 specifies a far pointer to the MCI_OVLY_OPEN_PARMS structure.
The following flags for lParam1 apply to waveform audio devices:
MCI_WAVE_OPEN_BUFFER | Indicates a buffer length is specified in the dwBuffer member of the structure identified by lParam2. |
Note that lParam2 specifies a far pointer to the MCI_WAVE_OPEN_PARMS structure. (Devices with extended command sets might replace this structure with a device-specific structure.)
If MCI_OPEN_SHAREABLE is not specified when a device or device element is initially opened, then all subsequent MCI_OPEN messages to the device or device element will fail. If the device or device element is already open, and this flag is not specified, the call will fail even if the first open command specified MCI_OPEN_SHAREABLE. Files for the MCISEQ and MCIWAVE devices are nonshareable.
Case is ignored in the device name, but there must not be any leading or trailing blanks.
To use automatic type selection (via the [mci extensions] section of the WIN.INI file), assign the file name (including file extension) to the lpstrElementName member, assign a NULL pointer to the lpstrDeviceType member, and set the MCI_OPEN_ELEMENT flag.
MCI_CLOSE, MCI_CLOSE_DRIVER, MCI_OPEN_DRIVER