How to play wma files?
This is a discussion on Playing wma files within the C++ Programming forums, part of the General Programming Boards category; How to play wma files?...
How to play wma files?
>How to play wma files?
How to search google? Seriously, this is a common question, so a decent google search will quickly give you a suitable answer.
My best code is written with the delete key.
Well, Windows Media Player is pretty good at playing it's own format
Google OpenAL, FMOD and DirectSound.
To play it in Windows Media Player, you could use system or ShellExecute.Code:#include <windows.h> #include <stdio.h> #if defined(_MSC_VER) # pragma comment(lib, "Winmm.lib") #endif /* * Plays an MP3 or WMA file. */ BOOL PlaySong(LPCTSTR szFile) { TCHAR szCommandString[1000]; 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)) { return TRUE; } return FALSE; } int main(void) { if (!PlaySong(TEXT("C:\\Path To\\Your Song.wma"))) { printf("Failed to play song!"); } getchar(); return 0; }