要处理消息,必须在这个函数中设置好最后三个参数,参考msdn:
dwCallback
Pointer to a fixed callback function, an event handle, a handle to a window, or the identifier of a thread to be called during waveform-audio playback to process messages related to the progress of the playback. If no callback function is required, this value can be zero. For more information on the callback function, see waveOutProc.
dwCallbackInstance
User-instance data passed to the callback mechanism. This parameter is not used with the window callback mechanism.
fdwopen
CALLBACK_EVENT The dwCallback parameter is an event handle.
CALLBACK_FUNCTION The dwCallback parameter is a callback procedure address.
CALLBACK_NULL No callback mechanism. This is the default setting.
CALLBACK_THREAD The dwCallback parameter is a thread identifier.
CALLBACK_WINDOW The dwCallback parameter is a window handle.
//检查音频输出设备是否能播放指定的音频文件
if (waveOutOpen(&hWaveOut, WAVE_MAPPER, lpFormat, (ULONG)m_hWnd, NULL, CALLBACK_WINDOW) != 0)
{
//Failed to OPEN the wave out devices
ShowMsg("Open the wave out devices failed!");
OnStop();
return;
}