The midiInClose function closes the specified MIDI input device.

MMRESULT midiInClose(
  HMIDIIN hMidiIn  



Handle to the MIDI input device. If the function is successful, the handle is no longer valid after the call to this function.

Return Values

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

Value Description
MIDIERR_STILLPLAYING Buffers are still in the queue.
MMSYSERR_INVALHANDLE The specified device handle is invalid.
MMSYSERR_NOMEM The system is unable to allocate or lock memory.


If there are input buffers that have been sent by using the midiInAddBuffer function and have not been returned to the application, the close operation will fail. To return all pending buffers through the callback function, use the midiInReset 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, midiInAddBuffer, midiInReset