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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EMCIDeviceError

Status
Not open for further replies.

cvaval

Programmer
Mar 25, 2002
5
HT
Hi!
I try to use a ttimer and a tmediaplayer component at the same time in a delphi application. When I run the program, I get this error: EMCIDeviceEror.The device name is already being used as an alias by this application. Use a unique alias .... How can I correct this error?
Thank you
Charlotte.
 
The first time you open the media player within your app, everything should be happiness. But if you open it a second time, you will see the error you describe.

To see what's going on, set a break point at each line of your prog that calls MyMediaPlayer.Open (or whatever your media player is called). The first time you hit it, you'll be fine; the second time, you know that you're about to get a visit from the error dialog.

So you need to avoid opening it twice. You can do this by opening it once in your form's Create, and then leaving it open 'til you get to your Form's Close. Or you can have a global variable called mediaplayeropen. When you open the media player, test to see if mediaplayeropen is True. If it is, you need to call MyMediaPlayer.Close before you open it again. And, of course, just after you open it, set mediaplayeropen to True.

Another way to cause the error that you're seeing is to have TMediaPlayer objects on two different forms of your app. When you open the second one, Windows will spit. Again the solution is to somehow close one before you open the other; or simply get rid of the second one, and refer back to the one on your first form. -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top