Good Question on WMA support for Windows Forms

 J. Daniel Smith in the comments to my last post writes:
Why doesn’t the new Sound control support WMA files? (Yes, I know it’s just a wrapper around the Win32 control…) 

But still, this “mixed messaging” from Microsoft is a bit annoying at times: use WMA (and not MP3)…unless you want to embed it in your application, then you have to use WAV.“



Very good questions, and I have to give a good response to someone with “Daniel“ in their name:)  You are correct, the sound control does not support wma files (or MP3 file for that matter). 


Since I don’t work on the team that built that control, don’t consider my answer definitive (someone from that team, feel free to chime in here), but I’ll give you my best guess.  One of the issues with playing sound files is that you need the codec that translates bits into music, and each music file type will have its own.  For example in MP3 files, you must license the codec from the Franhofer institute which owns the patent for MP3 (also known as Moving Picture Experts Group Layer-3 Audio), and this codec is currently in Windows Media Player, not in Windows.


Aside: For a short view on the history of MP3, visit


For wma files, again Windows Media Player is the application that contains the codec and not Windows itself. Rather then discuss how great it would be from a development perspective if you could assume that Windows OS had better support for great sound codecs built-in, (was there a lawsuit about us adding more features to Windows?? Nah, everyone loves us), I’ll stop here and tell you how you can solve this issue by using Windows Media Player:


What do you do if you want to play a WMA file in your Windows application?

You can easily play wma files by drag/dropping a Windows Media Player control onto your application, which will add the ability to play files just like WMP, and even includes other WMP features like playlist support.  This is done by adding a reference to the control – right click on the toolbox, select add items, select the COM tab, and scroll down to Windows Media Player (for reference it’s at: “C:\windows\system32\wmp.dll“).


I’ve included some links to code samples using WMP, including some by Duncan and Eric.



Comments (4)

  1. J. Daniel Smith says:

    I’ve decided it’s a lot easier just to drink Bill’s Kool-Aid. 🙂 It takes far too much effort to fight MS, and besides, you guys deliver A LOT of (way totally) COOL stuff.

    Yes, I know there are alternatives, and I know you didn’t write the control, and I know there are potential legal concerns.

    But wouldn’t it be nice if the nifty new control threw a CodecNotAvailableException when you tried to play a WMA (or MP3) file and the right codec wasn’t installed? Then you could push the problem to the installer ("Windows Media Player 9 is required") while your code remains clean. I can already envison a CodeProject article showing how to subclass the Sound control to do something just like this…

    Part of what was behind my original comments is my annoyance at the lack of widespread WMA support from Windows applications (one particular video editing company just released brand new "2004" versions with no WMA support 🙁 ), and the Sound control only supporting WAV just reinforces that. As far as I’m concerned, on a Windows box, WMA is "standard" not MP3.

    Thanks for the comments.

  2. Mahavir says:

    For some reaasons WMA files are not playing in my Media Player, I am using a standard version is that the reason ?

  3. Michael says:

    broken msdn.microsoftt links in the response to J. Daniel Smith