Using a Window or Thread to Process Driver Messages
[The feature associated with this page, Waveform Audio, is a legacy feature. It has been superseded by WASAPI and Audio Graphs. WASAPI and Audio Graphs have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use WASAPI and Audio Graphs instead of Waveform Audio, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
To use a window callback function, specify the CALLBACK_WINDOW flag in the fdwOpen parameter and a window handle in the low-order word of the dwCallback parameter of the waveInOpen or waveOutOpen function. Driver messages will be sent to the window procedure for the window identified by the handle in dwCallback.
Similarly, to use a thread callback, specify CALLBACK_THREAD and a thread handle in the call to waveInOpen or waveOutOpen. In this case, messages are posted to the specified thread instead of to a window.
Messages sent to the window or thread callback are specific to the audio device type used. For more information about these messages, see Playing Waveform-Audio Files.