You can use the notify
flag be notified when the song ends.
This seems to work:
case WM_CREATE:
mciSendString("open pickin0.mid type sequencer alias music", NULL, 0, NULL);
mciSendString("play music notify", NULL, 0, hWnd);
break;
case MM_MCINOTIFY:
mciSendString("seek music to start", NULL, 0, NULL);
mciSendString("play music notify", NULL, 0, hWnd);
break;
You need to pass your window handle when you use the notify command so it can send the MM_MCINOTIFY
command somewhere.