MODM_OPEN

Sent to a MIDI output driver to allocate a specified device for use by a client application.

MMSYSERR_NOTENABLED The driver failed to load or initialize.
MMSYSERR_ALLOCATED The device is already allocated by the maximum number of clients the driver supports or the device cannot be opened because of system resource limitations other than memory.
MMSYSERR_NOMEM The device cannot be opened because of a failure allocating or locking memory.

DWORD dwParam1
Specifies a far pointer to a MIDIOPENDESC structure. This structure contains additional information for the driver such as instance data from the client and a callback for the client.
DWORD dwParam2
Specifies option flags for opening the device.
CALLBACK_EVENT If this flag is specified, dwCallback in the MIDIOPENDESC structure is assumed to be an event handle.
CALLBACK_FUNCTION If this flag is specified, dwCallback in the MIDIOPENDESC structure is assumed to be the address of a callback function.
CALLBACK_THREAD If this flag is specified, dwCallback in the MIDIOPENDESC structure is assumed to be a handle to a thread.
CALLBACK_WINDOW If this flag is specified, dwCallback in the MIDIOPENDESC structure is assumed to be a window handle.
MIDI_IO_COOKED If this flag is specified, the device is being opened in stream mode. In stream mode, the driver may receive all Windows 3.1 messages as well as the stream messages. The device driver must be able to handle any contingencies which arise; for example, it must be able to play short messages and system exclusive messages asynchronously to the stream.
MIDI_IO_PACKED If this flag is specified, the driver is being opened in compatibility mode. (Compatibility mode is supported for applications written for the Windows 3.1 platform).

It is up to the driver to determine the number of clients allowed to use a particular device. Once a device is opened for the maximum number of clients the driver supports, the driver should return MMSYSERR_ALLOCATED for any additional open requests. If the open operation is successful, the driver should use the DriverCallback function to send the client a MOM_OPEN message.

See Also

MODM_CLOSE, MIDIOPENDESC