PlaySound - problems

PlaySound - problems

Post by Pong » Sun, 26 Oct 2008 05:46:12


I'm trying to play .wav files, one for a verification, and one for
error...This option will be set to two resource wave files, and then
they will be changed by the user...my code will play, but only the
default sound...I have tried every possible way to make it work, but
nothing, I'll show you a couple of ways, that seemed to fail for
me...I'm using the library winmm.a...somepeople it's Winmm.lib

main.c

...
#include "define.h"
PlaySound("C:\\WINDOWS\\Media\\Windows XP Ding.wav",NULL,SND_FILENAME
| SND_NODEFAULT);
PlaySound(MAKEINTRESOURCE(IDR_WAVE2),GetModuleHandle(NULL),SND_RESOURCE
| SND_NODEFAULT);
...

rc.rc

#include "define.h"
IDR_WAVE1 WAVE "C:\\WINDOWS\\Media\\Windows XP Ding.wav"
IDR_WAVE2 WAVE "C:\\WINDOWS\\Media\\Windows XP Error.wav"

define.h

//RESOURCE
#define IDR_WAVE1 900
#define IDR_WAVE2 901
 
 
 

PlaySound - problems

Post by Piranh » Sun, 26 Oct 2008 15:40:14


PlaySound(MAKEINTRESOURCE(IDR_WAVE1), GetModuleHandle(0),
SND_RESOURCE);

 
 
 

PlaySound - problems

Post by antoin » Sun, 26 Oct 2008 18:52:35


Does PlaySound() return FALSE ?
And when you lauch "C:\\WINDOWS\\Media\\Windows XP Ding.wav" in Explorer,
(Start-Run), does it launch the wav with associated applicaiton ?
 
 
 

PlaySound - problems

Post by Pong » Thu, 30 Oct 2008 11:21:22

Yes it returns false, and yes it does play the .wav file from the run
window (start -> Run)