The midiInPrepareHeader function prepares a buffer for MIDI input.
MMRESULT midiInPrepareHeader( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh );
Handle to the MIDI input device. To get the device handle, call midiInOpen.
Pointer to a MIDIHDR structure that identifies the buffer to be prepared.
Before calling the function, set the lpData, dwBufferLength, and dwFlags members of the MIDIHDR structure. The dwFlags member must be set to zero.
Size, in bytes, of the MIDIHDR structure.
Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.
||The specified device handle is invalid.|
||The specified address is invalid.|
||The system is unable to allocate or lock memory.|
Before you pass a MIDI data block to a device driver, you must prepare the buffer by passing it to the midiInPrepareHeader function. After the header has been prepared, do not modify the buffer. After the driver is done using the buffer, call the midiInUnprepareHeader function.
The application can re-use the same buffer, or allocate multiple buffers and call midiInPrepareHeader for each buffer. If you re-use the same buffer, it is not necessary to prepare the buffer each time. You can call midiInPrepareHeader once at the beginning and then call midiInUnprepareHeader once at the end.
Preparing a header that has already been prepared has no effect, and the function returns zero.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||mmeapi.h (include Windows.h)|