Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PlaySound() question - Please help! 3

Status
Not open for further replies.

Robertus

Programmer
Feb 16, 2001
81
RO
I need to know ALL the steps in order to use PlaySound() in a simple dialog based app. My app has only one button that I wish to play a sound when I click it. And that sound I want it loaded from REosurces.

I've tried including <mmsystem.h> but it seems that there is something elese that I should do since there appears an error LNK2001. There is something missing, I;m sure of it.


Thanks.

Robert Suditu.
suditurobert@yahoo.com
 
Just used this in a program not too long ago....try this

#include &quot;mmsystem.h&quot;

void CSomeClass::OnClickButtonSound()
{
//I used the sndPlaySound() cause it seemed easier
sndPlaySound(&quot;YourSound.wav&quot;, SND_ASYNC);
}

I know you said that you wanted to load it from a resource, but I didn't. You may wanna try something like this to load it from a resource.

PlaySound (&quot;&quot;,YOUR_RESOURCE_NAME, SND_RESOURCE);
Just fill in what your resource is named and it should work. Other than that, I can't help you anymore.

Hope that helps!

Niky Williams
NTS Marketing

 
Something I forgot to mention, make sure that you have a link to winmm.lib.

Goto Project->Settings
Click on the Link tab
Type in Winmm.lib in the Object/Librarie modules edit box
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top