MSDN quotation: The PlaySound Function
You can use the PlaySound function to play waveform audio, as long as the sound fits into available memory. (The sndPlaySound function offers a subset of the capabilities of PlaySound. To maximize the portability of your Win32-based application, use PlaySound, not sndPlaySound.)
void main ()
{
//read the msdn for the full description of the flags
if(!sndPlaySound("C:\\FULL_PATH_HERE\\YOUR_SONG.WAV", SND_NODEFAULT||SND_NOSTOP||SND_SYNC))
Thanks. I got the documentation on PlaySound() and sndPlaySound(), but whatever I try, it won't compile, and I get this message "Cannot open precompiled header file".
1. Make sure that you have included Windows.h
2. Link the Winmm.lib
3. Make sure that you have the correct syntax there. Assuming the compiler error message is accurate in determining your error (which sometimes it doesn't), it seems that your PlaySound() is treated as a variable instead of a function. Please paste the relevant part of your code if you still can't figure out what's wrong with your codes.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.