While a waveform is playing, you can monitor the current playback position within the waveform. The Multimedia extensions provide the following function for this purpose:
waveOutGetPosition
Retrieves the current playback position of a waveform output device.
This function takes three parameters: a handle to a waveform output device, a far pointer to an MMTIME structure, and a WORD specifying the size of the MMTIME structure.
For waveform devices, the preferred time format to represent the current position is in samples. Thus, the current position of a waveform device is specified as the number of samples for one channel from the beginning of the waveform.
To query the current position of a waveform device, set the wType field of the MMTIME structure to the constant TIME_SAMPLES and pass this structure to waveOutGetPosition.