Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

midiInPrepareHeader function

The midiInPrepareHeader function prepares a buffer for MIDI input.

Syntax


MMRESULT midiInPrepareHeader(
  HMIDIIN hMidiIn,
  LPMIDIHDR lpMidiInHdr,
  UINT cbMidiInHdr
);

Parameters

hMidiIn

Handle to the MIDI input device. To get the device handle, call midiInOpen.

lpMidiInHdr

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.

cbMidiInHdr

Size, in bytes, of the MIDIHDR structure.

Return value

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

Return codeDescription
MMSYSERR_INVALHANDLE

The specified device handle is invalid.

MMSYSERR_INVALPARAM

The specified address is invalid.

MMSYSERR_NOMEM

The system is unable to allocate or lock memory.

 

Remarks

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.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Mmsystem.h (include Windows.h)

Library

Winmm.lib

DLL

Winmm.dll

See also

Allocating and Preparing MIDI Data Blocks
MIDI Functions
midiInUnprepareHeader

 

 

Community Additions

Show:
© 2014 Microsoft