Jump to content
  • Advertisement
Sign in to follow this  
bikola_p

Win32 MCI audio Playback

This topic is 4825 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey guys, i have a problem with using mci, i have code to display the file open dialog which displays only mp3 and wma files, after selelcting a file the file extension is stored in szFileName: if(GetOpenFileName(&ofn)) { MessageBox(hwnd,szFileName,"File OPen",0); mciSendString("",szFileName,128,hwnd); } OK, Now, if i compile this i get no errors and no warning, when i choose to run, i get "The procedure entry point SMapLS could not be located in the dynamic link library KERNEL32.dll." When i comment out the mcisendstring() and leave the messagebox(), it runs fine and returns the correct full path of the file. What am i doing wrong with the mcisendstring function. Also note, i linked the winmm.dll and am using mmsystem.h I cant figure out what i'm doing wrong.

Share this post


Link to post
Share on other sites
Advertisement
First you need to open the file:

string Command;
Command="open "+szFileName;
mciSendString(Command.c_str(),NULL,0,hwnd);

Then play it:

Command="play "+szFileName+" from 0";
mciSendString(Command.c_str(),NULL,0,hwnd);

Share this post


Link to post
Share on other sites
This doesnt work for me, i created a new var of type string called Command, and pasted your code, but i get errors with +szFileName+ and how (+)'s are binary operatives, i include string.h

Share this post


Link to post
Share on other sites
ok, i finally have the program compiling after adding your codem however i get the same error, about the entry point, here is a snip of my code.
_--------------------------------------------------

case IDM_OPEN:
{
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";

ZeroMemory(&ofn, sizeof(ofn));

ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "MPlayer Files(*.wma,*.mp3)\0*.mp3\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "wma","mp3";
if(GetOpenFileName(&ofn))
{
sFileName=szFileName;

string FileName;
FileName="open "+sFileName;
mciSendString(FileName.c_str(),NULL,128,hwnd); <--/*The error lies here, i can replace mciSendString with MessegeBox(hwnd,FileName.c_str(),"open",0 ) and it displays the full extension with the word open in front of it.*/

}
}
break;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!