How would i make it so in my program there is a button when that button is clicked i want it to play a .wma file without opening and media player?
5 Answers
The C++ standard does not include this functionality. That means it depends on what your system offers.
For Windows, you can try something like PlaySound.
However, you best bet is to use a pre-existing library, like:
Searching for C++ Sound Library brings up a lot of information.
Also, check out these three other SO topics:
-
1Playsound doesn't play .wma files, only .wav. – Steve Rowe Apr 26 '09 at 05:04
Although the above answer mentions it (and everything else, it doesn't give any recommendations so...), FMOD is the king of C++ sound (the most used) and works great so I'd recommend FMOD in particular.

- 68,773
- 61
- 187
- 272
For Windows, in all honesty your best bet is DirectShow. The RenderFile API allows you to play most audio file types with just a few lines of code.
The best part about DirectShow is that it's a part of the Windows platform so you don't need to bundle an external component.

- 16,086
- 32
- 60