Playing a music file

I am using the ShellExecute feature in one of my programs to open the default player and play an mp3 file. This feature works well, but the only problem is that I would like to be able to play a few files, one right after the other. The way my code is now it will start playing the first file and immediately resume to the next line in code. How can I program it so that it won't look for the next file until the previous song is finished playing?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You have to use the OCX of media player and not shell execute ...

You use the OCX to play is pretty simple you have all info in the microsoft site :

and after that you know how to use it
you have only to play the next in the list when it finish to play the current

       If you have problem let me know
damonc090698Author Commented:
Thanks Faraj for the response, but I am using shell execute so that I can have it open up in the default program for the file (not necessarily Media Player). What I need to know is how I can control when the songs are played. Any ideas?
damonc090698Author Commented:
Adjusted points to 200
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Most MP3 Players will support playing ".M3U" files...

An M3U file is nothing more than a text file containing the paths to MP3 files.  Basically it acts as a "play list".

All you have to do is create a text file with the ".M3U" extension and put the path to each MP3 you want to play on a separate line in the file.

Then, instead of using your ShellExecute to launch the MP3, launch the M3U file...

Hope this helps...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
damonc090698Author Commented:
Thank you! That is a very cool trick. I never knew what a .m3u file was.  The only other issue that I will have now is how to tell when the playlist is done playing so that I can close the mp3 player. Any ideas?
Unfortunately, because you're using shellexecute to play your mp3/m3u files, there's no way of knowing when the play is over...

To have more control over your app, you really need to use a control like the mediaplayer control.

You can get this control from microsoft when you install MediaPlayer 6.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.