If you want to play the file with Windows Media Player, you could try the ShellExecute function:
If you want to play a WMA file without opening WMP, you can use mci as shown by this webpage. Here is a simple sample:
ShellExecute(NULL, NULL, TEXT("C:\\SomePath\\filename.wma"), NULL, NULL, SW_SHOWMINNOACTIVE);
The mci command language has many more options. For example, you can pause and resume, play a specific part of the song and get notification of when the song finishes playing. The mci reference is here.
#pragma comment(lib, "Winmm.lib")
BOOL PlaySong(LPCTSTR szFile)
wsprintf(szCommandString, TEXT("open \"%s\" type mpegvideo alias MediaFile"), szFile);
/* By default mci functions will return immediately and the task will be carried out
* asynchronously. To have the function wait, place the word "wait" at the end of the
* command string. ie. "play MediaFile wait" */
if (ERROR_SUCCESS == mciSendString(szCommandString, NULL, 0, NULL) &&
ERROR_SUCCESS == mciSendString(TEXT("play MediaFile"), NULL, 0, NULL))
if ( !PlaySong(TEXT("C:\\PathTo\\My Music\\MySong.wma")) )
printf("Failed to play song!");
Another alternative is DirectShow. This is a DirectShow sample that plays a file.