Is it possible to play a .wav file in MSVC++? If not, I will make do with Beep(freq, dur).
Printable View
Is it possible to play a .wav file in MSVC++? If not, I will make do with Beep(freq, dur).
Hi, I have the solution for you. It took me a long time to figure this out too. First of all I know that this works in a win32 console app. but i don't know about any other kind of program.
1) first go to Project/Setting/Link Tab
2)in the Object/Library Modules: box add this winmm.lib at the end of that list and make sure to put a space between it and the last one.
3)then hit ok
Then to play a sound your program could look like the second example on
this page
Note: you don't have to write out the full path of the file you want to play if it's in the same folder as your program.
also the parameter of SND_FILENAME can change depending on what you want your sound to do (ie. if you want it to not slowdown or mess up the flow of the program and repeat you would use SND_ASYNC|SND_LOOP instead). You can find out about the parameters at
this site