Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenDialog on cancel

Status
Not open for further replies.

Ante0

Programmer
Apr 19, 2007
98
SE
Hi, I'm pretty new at this, but I need some help :)
I just made an MP3 player that runs off the system tray.
It's pretty simple, just open a song, then it automatically plays it.
My question is, when I open a song and then click on Cancel in the Openfile Dialog, I get an error. Since no song is selected, it tries to call (My play button is called Play) Play->Click();
But since there is no song loaded into MediaPlayer1 I get an error.
Is there any way to simply not allow pressing Cancel in the OpenDialog? (I've been googling, and looking in C++Builder6, with no success)
Or any code snippet that would help is also appreciated.
Using C++Builder6.
Thanks
Ante
 
Guess there's no way to Edit your posts then...
Well, I'm just plain stupid...
All I needed was to use
if (OpenDialog1->Execute()) {

Oh well. If any Mods see this, please close/remove this post.
 
Just off the top of my head, you could use a try catch or try finally statement. These would trap the error and then you could implement your own code.



James P. Cottingham
-----------------------------------------
I'm number 1,229!
I'm number 1,229!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top