The midiDisconnect function disconnects a MIDI input device from a MIDI thru or output device, or disconnects a MIDI thru device from a MIDI output device.

MMRESULT midiDisconnect(
  HMIDI hMidi,      
  HMIDIOUT hmo,     
  LPVOID pReserved  



Handle to a MIDI input device or a MIDI thru device.


Handle to the MIDI output device to be disconnected.


Reserved; must be NULL.

Return Values

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

Value Description
MMSYSERR_INVALHANDLE Specified device handle is invalid.


MIDI input, output, and thru devices can be connected by using the midiConnect function. Thereafter, whenever the MIDI input device receives event data in an MIM_DATA message, a message with the same event data is sent to the output device driver (or through the thru driver to the output drivers).


**  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, midiConnect, MIM_DATA