WINMM sends the
MODM_OPEN message to the modMessage function of a MIDI output driver to allocate a specified device that a client application can use.
DWORD modMessage( UINT uDeviceID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2 );
Specifies the ID of the target device. Device IDs are sequential and have an initial value of zero and a final value equal that is to one less than the number of devices that the driver supports.
WINMM sets this parameter to MODM_OPEN when it calls modMessage to process this message.
The MIDI output driver must fill this location with its instance data, but only in response to the
This parameter 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 function for the client.
This parameter specifies option flags that determine how the device is opened. The flags can be any of the values in the following table.
If this flag is specified, dwCallback in the MIDIOPENDESC structure is assumed to be an event handle.
If this flag is specified, dwCallback in the MIDIOPENDESC structure is assumed to be the address of a callback function.
If this flag is specified, dwCallback in the MIDIOPENDESC structure is assumed to be a handle to a thread.
If this flag is specified, dwCallback in the MIDIOPENDESC structure is assumed to be a window handle.
If this flag is specified, the device is opened in stream mode and the driver receives stream messages. The driver must be able to handle any contingencies that arise. For example, the driver must be able to play short messages and system-exclusive messages asynchronously to the stream.
The modMessage function returns MMSYSERR_NOERROR if the operation is successful. Otherwise it returns one of the error messages in the following table.
The driver failed to load or initialize.
The MIDI device is already allocated by the maximum number of clients that the driver supports or the device cannot be opened because of system resource limitations other than memory.
The device cannot be opened because of a failure to allocate or lock memory.
The driver must be able to determine the number of clients it can allow to use a particular device. After a device is opened for the maximum number of clients that the driver supports, the driver returns MMSYSERR_ALLOCATED for any additional requests to open the device. If the open operation is successful, the driver uses the DriverCallback function to send the client a MOM_OPEN message.
Available in Windows XP and later Windows operating systems.
|Mmddk.h (include Mmddk.h, Mmsystem.h, or Windows.h)|