Solved

Opendialog and Mediaplayer

Posted on 1998-05-09
1
326 Views
Last Modified: 2010-04-06
hi,

This may sound stupid, and easy to solve. But I cannot find anything about the opendialog in the help file (Delphi 3.0) When I select a file, I load it in Mediaplayer open it, and so on. But if I select nothing and click cancel in the opendialog, I get an error. saying that the MMSystem is...., So how do I trap the error so I can close the opendialog so nothing will happen.
Now I have

If opendialog1.execute then
 MediaPlayer1.Filename := Opendialog1.Filename;
 MediaPlayer1.Open;
...
So how do I trap the event that nothing is selected, and safely close the opendialog without errordialogs poping up.  a small example of how would help.

thanks
0
Comment
Question by:hellfire052497
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
roosiedb earned 100 total points
ID: 1343922
Hello,

To solve your problem, try this one:

If OpenDialog1.Execute then
BEGIN
  MediaPlayer1.FileName:=OpenDialog1.FileName;
  MediaPlayer1.Open;
END;

I guess you forgot the BEGIN- and END-statements.

Good luck!

Stefan van Roosmalen.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question