I managed to get midi playback working on WM6 using SndPlayAsync. Now I would like to be able to loop the midi. The only way I can see to do this is to detect when the file stops playing and play it again. I believe I might be able to detect the event using SndGetWaitHandle, but I don't know what to do with the event handle once it's retrieved.
static extern uint SndGetWaitHandle(IntPtr hSound, ref IntPtr phDoneEvent);
Can anyone tell me how to set up an event handler for this kind of event handle? Or if there is an easier way to loop the midi, that would be preferable.