Using a Callback Function to Process Driver Messages
You can write your own callback function to process messages sent by the device driver. To use a callback function, specify the CALLBACK_FUNCTION flag in the fdwOpen parameter and the address of the callback in the dwCallback parameter of the waveInOpen or waveOutOpen function.
Messages sent to a callback function are similar to messages sent to a window, except they have two DWORD parameters instead of a UINT and a DWORD parameter. For details on these messages, see Playing Waveform-Audio Files.
To pass instance data from an application to a callback function, use one of the following techniques:
- Pass the instance data using the dwInstance parameter of the function that opens the device driver.
- Pass the instance data using the dwUser member of the WAVEHDR structure that identifies an audio data block being sent to a device driver.
If you need more than 32 bits of instance data, pass a pointer to a structure containing the additional information.