include <windows.h>
#include <stdio.h>
HWND hWndMain;
BOOL PlayMidi(char *sFileName)
{
char buf[256];
sprintf(buf, "open %s type sequencer alias MUSIC", sFileName);
if (mciSendString("close all", NULL, 0, NULL) != 0)
{
return(FALSE);
}
if (mciSendString(buf, NULL, 0, NULL) != 0)
{
return(FALSE);
}
if (mciSendString("play MUSIC from 0", NULL, 0, hWndMain) != 0)
{
return(FALSE);
}
return TRUE;
}
BOOL PauseMidi()
{
if (mciSendString("stop MUSIC", NULL, 0, NULL) != 0)
{
return(FALSE);
}
return TRUE;
}
BOOL ResumeMidi()
{
if (mciSendString("play MUSIC notify", NULL, 0, hWndMain) != 0)
{
return(FALSE);
}
return TRUE;
}
BOOL StopMidi()
{
if (mciSendString("close all", NULL, 0, NULL) != 0)
{
return(FALSE);
}
return TRUE;
}
BOOL ReplayMidi()
{
if (mciSendString("play MUSIC from 0 notify", NULL, 0, hWndMain) != 0)
{
return(FALSE);
}
return TRUE;
}