Playing Wave files on startup
-
I'm pretty much a complete newbie to the programming scene. I can't for the life of me work out how to play a wave file. Preferably during the startup of the application but even if it was on the press of a button. I have read about the PlaySound and DirectSound classes/functions (whatever they are) but cannot get them to work. Also i have come across what looks like a really good class (cSound) for download on this website but apparently it doesnt work in Windows XP, and i cant get that to work either. I need to know everything i would need to do (initialisation and all that) coz im completely lost and this is getting very frustrating.:confused: even a link to a class i can use or step by step tutorial would be a big help. o and im using VC++.net Cheers jace
-
I'm pretty much a complete newbie to the programming scene. I can't for the life of me work out how to play a wave file. Preferably during the startup of the application but even if it was on the press of a button. I have read about the PlaySound and DirectSound classes/functions (whatever they are) but cannot get them to work. Also i have come across what looks like a really good class (cSound) for download on this website but apparently it doesnt work in Windows XP, and i cant get that to work either. I need to know everything i would need to do (initialisation and all that) coz im completely lost and this is getting very frustrating.:confused: even a link to a class i can use or step by step tutorial would be a big help. o and im using VC++.net Cheers jace
Whether you beleive or not it is really as easy to play a wave file from your app as writing the following:
sndPlaySound("c:\\yourwavetoplay.wav",SND_ASYNC);
Put it into your OnInitDialog override to play it on application startup. However, in order to use it, you have to add the windows multimedia library to your project So, BEFORE you call the above line, add to your code:
#include "mmsystem.h"
#pragma comment(lib,"Winmm.lib")Peter Molnar