//声明:midiInAddBuffer( hMidiIn: HMIDIIN; {输入设备句柄} lpMidiInHdr: PMidiHdr; {TMidiHdr 结构的指针} uSize: UINT {TMidiHdr 结构的大小}): MMRESULT; {成功返回 0; 可能的错误值如下:}MMSYSERR_INVALHANDLE = 5; {设备句柄无效}MIDIERR_UNPREPARED = 64; {没有准备好缓冲区}//TMidiHdr 是 midihdr_tag 结构的重定义:midihdr_tag = record lpData: PChar; {专用缓冲区的指针} dwBufferLength: DWORD; {指定缓冲区长度} dwBytesRecorded: DWORD; {输入时, 指定缓冲区中的数据量} dwUser: DWORD; {指定用户数据} dwFlags: DWORD; {指定缓冲区信息标志} lpNext: PMidiHdr; {保留(给设备)} reserved: DWORD; {保留(给设备)} dwOffset: DWORD; {回调开始时, 缓冲区的偏移} dwReserved: array[0..7] of DWORD; {保留(给系统)}end;//dwFlags 的可选值:MHDR_DONE = $00000001; {设备已把缓冲区交还给程序}MHDR_PREPARED = $00000002; {已为 midiInPrepareHeader 或 midiOutPrepareHeader 准备好缓冲区}MHDR_INQUEUE = $00000004; {保留(给设备)}MHDR_ISSTRM = $00000008; {是流缓冲区} //举例: