Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a application which plays mp3 file using MCI device API. I was able to play mp3 file first time but when I run the same file secon time it gives in following error.

MCI Error
---------------------------
The specified file cannot be played on the specified MCI device.  The file may be corrupt, not in the correct format, or no fil


I have used following code to create a device and play the file.
C#
m_Path = _T("res\\phoneringing.mp3");
m_Video = MCIWndCreate(/*this->GetSafeHwnd()*/ m_hWnd,
    AfxGetInstanceHandle(),WS_CHILD|WS_VISIBLE|MCIWNDF_NOMENU|MCIWNDF_NOPLAYBAR,m_Path);


I have observed that when my application creates the device second time using MCIWndCreate it throws this error. For this I have handled all the events such as MCIWndStop, MCIWndClose, MCIWndDestroy API's to stop and destroy the created window. But still I am facing the same issue. Can some one help to override this error. I tried with MCIWNDF_NOERRORDLG to supress the error dialog but this does not show the error message but I unable to play the file.

Please suggest.
Posted
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900