How do I write a WaveOutOpen callback proc?

I don't know how to make a "callbacked" procedure when playing continuous sound.

Currently I call WaveOutOpen with no callback, play my sound buffer (WavePrepareHeader & WaveOutWrite), then
pause for 5 seconds with Sleep(5000).  Then I can close the wave connection with WaveOutClose.  It works,
but this is way short of what I want to do.

Instead of this:
  ErrorNum := waveOutOpen(pWaveHandle, WAVE_MAPPER, pWaveForm, 0, 0, CALLBACK_NULL);

I would like to do this:
  ErrorNum := waveOutOpen(pWaveHandle, WAVE_MAPPER, pWaveForm, Integer(@TMMForm.WaveCallback), 0,
              CALLBACK_FUNCTION);

I think this way my program could continue without delay.  When the buffer is done (?), WaveCallback would
receive the WOM_DONE message, and it could either start a new buffer or close the connection.

The problem is, I don't know how to declare my WaveCallback procedure.  What are the parameters?

I am not at all a novice programmer, but my experience is mostly in DOS.  I'm fairly new to Windows
programming.  If it weren't for that lousy help system . . .   Oh well.  :_[

Please reply by email or send me a note to check here.

Thanks,

Walton Dell
d...@butter.pvt.k12.az.us