waveInUnprepareHeader

  MMRESULT waveInUnprepareHeader(hWaveIn, lpWaveInHdr, wSize)    
  HWAVEIN hWaveIn;    
  LPWAVEHDR lpWaveInHdr;    
  UINT wSize;    

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

hWaveIn

Specifies a handle to the waveform input device.

lpWaveInHdr

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

wSize

Specifies the size of the WAVEHDR 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.
WAVERR_STILLPLAYING lpWaveInHdr is still in the queue.
MMSYSERR_HANDLEBUSY The handle hWaveIn is in use on another thread.

Comments

This function is the complementary function to waveInPrepareHeader. You must call this function before freeing the data buffer with GlobalFree. After passing a buffer to the device driver with waveInAddBuffer, you must wait until the driver is finished with the buffer before calling waveInUnprepareHeader. Unpreparing a buffer that has not been prepared has no effect, and the function returns zero.

See Also

waveInPrepareHeader