Solved

Opendialog and Mediaplayer

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month7 days, 14 hours left to enroll

632 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