Solved

Opendialog and Mediaplayer

Posted on 1998-05-09
1
323 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now