I found the answer elsewhere so I'm sharing it.
It appears that the play
command by itself is perfectly valid.
So here are a couple of ways to call this:
// (a)
mciSendString("open waveaudio!MyFile.wav alias MyFile",NULL,0,0);
mciSendString("play MyFile wait",NULL,0,0);
mciSendString("close MyFile",NULL,0,0);
// (b)
mciSendString("open MyFile.wav alias MyFile",NULL,0,0);
mciSendString("play MyFile wait",NULL,0,0);
mciSendString("close MyFile",NULL,0,0);
// (c)
mciSendString("play MyFile.wav wait",NULL,0,0); // no open or alias used
Answer found on MSDN Forums.
Once important thing worth noting is thatmciSendString
will fail miserably if you supply it with filename with spaces in the path (e.g. C:\Program Files...). Even if you enclose this into quotes it won't help. The solution is to use GetShortPathName
Windows function to get a DOS-like path from NTFS path name and which doesn't have spaces in it.