The midiInAddBuffer function sends an input buffer to a specified opened MIDI input device. This function is used for system-exclusive messages.

MMRESULT midiInAddBuffer(
  HMIDIIN hMidiIn,        
  LPMIDIHDR lpMidiInHdr,  
  UINT cbMidiInHdr        



Handle to the MIDI input device.


Pointer to a MIDIHDR structure that identifies the buffer.


Size, in bytes, of the MIDIHDR structure.

Return Values

Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.

Value Description
MIDIERR_STILLPLAYING The buffer pointed to by lpMidiInHdr is still in the queue.
MIDIERR_UNPREPARED The buffer pointed to by lpMidiInHdr has not been prepared.
MMSYSERR_INVALHANDLE The specified device handle is invalid.
MMSYSERR_INVALPARAM The specified pointer or structure is invalid.
MMSYSERR_NOMEM The system is unable to allocate or lock memory.


When the buffer is filled, it is sent back to the application.

The buffer must be prepared by using the midiInPrepareHeader function before it is passed to the midiInAddBuffer function.


**  Windows NT/2000/XP:** Included in Windows NT 3.1 and later.
**  Windows 95/98/Me:** Included in Windows 95 and later.
**  Header:** Declared in Mmsystem.h; include Windows.h.
**  Library:** Use Winmm.lib.

See Also

Musical Instrument Digital Interface (MIDI), MIDI Functions, MIDIHDR, midiInPrepareHeader