WORD midiInUnprepareHeader(hMidiIn, lpMidiInHdr, wSize)
This function cleans up the preparation performed by midiInPrepareHeader. The midiInUnprepareHeader function must be called after the device driver fills a data buffer and returns it to the application. You must call this function before freeing the data buffer.
HMIDIIN hMidiIn
Specifies a handle to the MIDI input device.
LPMIDIHDR lpMidiInHdr
Specifies a pointer to a MIDIHDR structure identifying the data buffer to be cleaned up.
WORD wSize
Specifies the size of the MIDIHDR structure.
Returns zero if the function was successful. Otherwise, it returns an error number. Possible error returns are:
MMSYSERR_INVALHANDLE
Specified device handle is invalid.
MIDIERR_STILLPLAYING
lpMidiInHdr is still in the queue.
This function is the complementary function to midiInPrepareHeader. You must call this function before freeing the data buffer with GlobalFree. After passing a buffer to the device driver with midiInAddBuffer, you must wait until the driver is finished with the buffer before calling midiInUnprepareHeader. Unpreparing a buffer that has not been prepared has no effect, and the function returns zero.
midiInPrepareHeader