MODM_OPEN - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// mmddk.h

DWORD modMessage(
   UINT      uDeviceID,
   UINT      uMsg,
   DWORD_PTR dwUser,
   DWORD_PTR dwParam1,
   DWORD_PTR dwParam2
);
View the official Windows hardware development documentation

NtDoc

No description available.

Windows hardware development documentation (modm-open)

MODM_OPEN function

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.

Parameters

Flag Meaning
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 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.

Return value

The modMessage function returns MMSYSERR_NOERROR if the operation is successful. Otherwise it returns one of the error messages in the following table.

Return code Description
MMSYSERR_NOTENABLED The driver failed to load or initialize.
MMSYSERR_ALLOCATED 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.
MMSYSERR_NOMEM The device cannot be opened because of a failure to allocate or lock memory.

Remarks

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.

Requirements

Target platform Desktop
Version Available in Windows XP and later Windows operating systems.
Header Mmddk.h (include Mmddk.h, Mmsystem.h, or Windows.h)

See also

modMessage

MIDIOPENDESC

DriverCallback

MOM_OPEN