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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sound in VC++?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Is there any way to play a WAV file in VC++ 6.0?? Any code? activeX control?
 
You don't have to use MFC or ActiveX at all.

I personally used many times the API Function PlaySound which is pretty straightforward.I gauratee it works 100%.

For this you need to do the following:
1.In your stdafx.h file you add a line:
#include <mmsystem.h>
2.In system menu Project->Settings->Link->Object/library modules you add winmm.lib to the lib files that you have there.

That's it. You can now call PlaySound API function.
Make sure to put a call to PlaySound with no filename argument - to stop the WAV file you are playing at user request (for example whe he suddenlly closes the application) - otherwise you will get an ASSERT.

Hope of being of some help, s-) Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
You can use Windows Media Player as COM object what offers all what you need for plaing not only sounds. Just add an ActiveX based class with ClassWizard. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top