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

CD Eject Problem

Status
Not open for further replies.

tedi1

Technical User
Aug 25, 2002
87
0
0
IL
Hi,

I have a program that run from CD. I wanted to eject the CD when the program finishes running.
The problem I'm facing is this: after the CD ejects I'm getting an err due to the fact the CD is not in the CD-Rom drive.

Is there any solution to eject the CD without getting the err.

Thanx
 

tedi1, have you read FAQ222-2244 yet? Especially item 15?

Don't try to access the drive after you have ejected the cd.

Good Luck and Good Reading of FAQ222-2244.

 
vb5prgrmr,
Thanx, now I have read the FAQ.
In regarding to my question, is there any way I can close the program after the CD tray had been opened?

By the way I'm using VB6.0 sp5
 

Yes there is...

There is code on this site from just a few days ago about testing to see if the drive is ready using the FSO (File System Object (MS Scripting Runtime reference needed)). If you search for it I am sure you will find it useful.

So what you would do is to check to see if the drive is ready and if not close (or prompt the user and give them the option of closing).

Good Luck

 
A solution may be to create a vbscript in a temp dir that will wait 3 seconds or so then eject the cd. The last thing you prog does is start that script. Then you can close your prog with the cd in, but the cd will still eject.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top