The midMessage Entry Point for MIDI Input Drivers

A MIDI input driver must have an entry-point function named midMessage to process messages sent by MMSYSTEM. The syntax of midMessage is:

DWORD midMessage(uDeviceID, uMsg, dwUser, dwParam1, dwParam2)

The parameter uDeviceID is a UINT specifying an ID for the target device. Device IDs are sequential, starting at zero and ending at a value equal to one less than the number of devices the driver supports.

The parameter uMsg is a UINT specifying the message being sent to the driver. The driver should return MMSYSERR_NOTSUPPORTED if it does not support the specified message.

The parameter dwUser is a DWORD of instance information for use by the driver. The driver should fill this location with its instance data (for example, a far pointer to a data structure). For any other messages, the instance data is returned to the driver. Drivers supporting multiple clients can use this instance data to keep track of which client is associated with the message.

The parameters dwParam1 and dwParam2 are message-dependent.

The low-order word of the return value specifies a message-dependent return value or error code. The high-order word should be zero.