PlaySound problems in WinXP

PlaySound problems in WinXP

Post by M. Kool » Fri, 26 Nov 2004 20:12:06


Hi,

We're having some trouble here to get a sound played. We have the
following code:

#include <mmsystem.h>
void PlayJobNotificationSound( int32 inResourceID)
{
if( !::PlaySound( MAKEINTRESOURCE( inResourceID), ::GetModuleHandle(
NULL), SND_RESOURCE | SND_NODEFAULT))
{
::MessageBeep( MB_ICONEXCLAMATION);
}
}

I have downloaded a sample project which employs the same method and it
works fine there. If we try it in our application, it just doesn't work;
it always returns FALSE. What's up with that??

Thanks!

--
Maarten Kools
___________________________________________
Van Gennep - Media Automation Consulting bv
Burg. Stramanweg 105
1101 AA Amsterdam
The Netherlands

Phone: +31-20-697 6029
Fax: +31-20-697 2249
E-mail: XXXX@XXXXX.COM
WWW: http://www.yqcomputer.com/
WWW: http://www.yqcomputer.com/
___________________________________________
 
 
 

PlaySound problems in WinXP

Post by Johan Rose » Sun, 28 Nov 2004 17:00:41

Maarten,

The documentation for PlaySound says it returns FALSE if the sound can't be
found. If the same code works in an example, this would seem like the most
likely problem. I'm sure you've checked and re-checked the resource id,
which leaves the module handle to investigated.

Johan Rosengren
Abstrakt Mekanik AB

"M. Kools" < XXXX@XXXXX.COM > a rit dans le message de

 
 
 

PlaySound problems in WinXP

Post by M. Kool » Thu, 02 Dec 2004 01:25:28

Hi,

Sorry for my late reply. I have solved the problem in the meantime. We
had used a wav file in the wrong format, which was kind of tricky to
find that out since Media Player had no problem playing the sound.
Apparently PlaySound only takes wav files in RIFF format, and we didn't
have that for some reason (I think the file was originally created on
the Macintosh).

thanks anyway!





--
Maarten Kools
___________________________________________
Van Gennep - Media Automation Consulting bv
Burg. Stramanweg 105
1101 AA Amsterdam
The Netherlands

Phone: +31-20-697 6029
Fax: +31-20-697 2249
E-mail: XXXX@XXXXX.COM
WWW: http://www.yqcomputer.com/
WWW: http://www.yqcomputer.com/
___________________________________________