midiOutPrepareHeader

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

The midiOutPrepareHeader function prepares a MIDI system-exclusive data block for output.

Parameters

hMidiOut

Specifies a handle to the MIDI output device.

lpMidiOutHdr

Specifies a far pointer to a MIDIHDR structure that identifies the data block to be prepared.

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.
MMSYSERR_NOMEM Unable to allocate or lock memory.

Comments

The MIDIHDR data structure and the data block pointed to by its lpData field must be allocated with GlobalAlloc using the GMEM_MOVEABLE and GMEM_SHARE flags and locked with GlobalLock. Preparing a header that has already been prepared has no effect, and the function returns zero.

See Also

midiOutUnprepareHeader