MODM_DATA function

MMSYSTEM sends the MODM_DATA message to the modMessage function of a MIDI output driver when the client wants to make a single MIDI event available as output.


DWORD modMessage(
   UINT      uDeviceID,
   UINT      uMSG,
   DWORD_PTR dwUser,
   DWORD_PTR dwParam1,
   DWORD_PTR dwParam2


  • uDeviceID
    Specifies the ID of the target device. Device IDs are sequential and have an initial value of zero and a final value that is equal to one less than the number of devices that the driver supports.

  • uMSG
    WINMM sets this parameter to MODM_DATA when it calls modMessage to process this message.

  • dwUser
    Use this parameter to return instance data to the driver. Drivers that support multiple clients can use this instance data to track the client that is associated with the message.

  • dwParam1
    Specifies the MIDI event that will be available at the output. The low-order byte is the first byte of the event.

  • dwParam2
    Not used.

Return value

If the operation is successful, modMessage returns MMSYSERR_NOERROR. Otherwise, it returns one of the error messages in the following table.

Return code Description

The driver failed to load or initialize.


The MIDI hardware is busy processing other data.


This message is used to make all MIDI events available as output, except system-exclusive events. System-exclusive events are communicated with the MODM_LONGDATA message. MIDI events that are communicated with MODM_DATA can be one, two, or three bytes long. The driver must parse the event to determine how many bytes to transfer. Unused bytes are not guaranteed to be zero.

The driver developer can develop a driver to not return until the message has been sent to the output device. Alternatively, the driver can return immediately and the MIDI data can be output in the background.


Target platform



Available in Windows XP and later Windows operating systems.


Mmddk.h (include Mmddk.h, Mmsystem.h, or Windows.h)

See also



Send comments about this topic to Microsoft