Solved

Opendialog and Mediaplayer

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
indy Tmemory stream non latin charcter issue 2 111
Delphi: ForceDirectory plain function 7 32
Performance of SQL statement 37 111
Firemonkey DbLookupComboBox equivalent ? 2 47
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 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