midiOutUnprepareHeader

  MMRESULT midiOutUnprepareHeader(hMidiOut, lpMidiOutHdr, wSize)    
  HMIDIOUT hMidiOut;    
  LPMIDIHDR lpMidiOutHdr;    
  UINT wSize;    

The midiOutUnprepareHeader function cleans up the preparation performed by midiOutPrepareHeader. The midiOutUnprepareHeader 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.

Parameters

hMidiOut

Specifies a handle to the MIDI output device.

lpMidiOutHdr

Specifies a pointer to a MIDIHDR structure identifying the buffer to be cleaned up.

wSize

Specifies the size of the MIDIHDR structure.

Return Value

Returns zero if the function was successful. Otherwise, it returns an error number. Possible error returns are:

Value Meaning

MMSYSERR_INVALHANDLE Specified device handle is invalid.
MIDIERR_STILLPLAYING lpMidiOutHdr is still in the queue.

Comments

This function is the complementary function to midiOutPrepareHeader. You must call this function before freeing the data buffer with GlobalFree. After passing a buffer to the device driver with midiOutLongMsg, you must wait until the driver is finished with the buffer before calling midiOutUnprepareHeader.

Unpreparing a buffer that has not been prepared has no effect, and the function returns zero.

See Also

midiOutPrepareHeader