Click here to Skip to main content
12,395,645 members (68,273 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ audio-video
I see a code to play a wav file:

TCHAR szMCIString[260];
TCHAR szDevType[245];
TCHAR szFileName[245];
MCIERROR dwReturn;
wcscpy(szFileName,L"E:\\v.mp3");
wcscpy(szDevType,L"wavaudio");
_stprintf(szMCIString,_T("open %s type %s alias MyWAV"),szFileName,    szDevType);
dwReturn = mciSendString(szMCIString, NULL, 0, NULL);

my file is E:\\v.mp3, but it can't play this file. so i use getlasterror to get error

TCHAR szError[128];
   //mciSendCommand(mciDevID, MCI_CLOSE, 0, 0L);
   mciGetErrorString(dwReturn, szError, 128);
   MessageBox(NULL,szError, L"Error", MB_OK);

the error receive is "The specified file device is not or is not recognized by MCI. Confused | :confused:
HELP ME! Cry | :((
Posted 28-Apr-10 0:34am
Updated 28-Apr-10 1:12am
Moak11.5K
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Why do you think "v.mp3" is a wave file?
Smile | :)
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

oh! sorry, this isn't my error code.
wcscpy(szFileName,L"E:\\v.mp3");
my code is wcscpy(szFileName,L"E:\\v.wav"); but it is in error! thanks for help.

PS: how i can play mp3 file, MCI is not have a format for mp3.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 28 Apr 2010
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100