Programmatically load/eject CD drive in VB or Java

10 pts.
Tags:
Java
Visual Basic
I want to eject or load the cd drive by coding in vb/java.. can you help me..........

Answer Wiki

Thanks. We'll let you know when a new response is added.

VB.Net code to eject or close the CD drive door.

Sub OpenCDDoor()
mciSendString “Set CDAudio Door Open Wait”, 0&, 0&, 0&
End Sub

Private Sub Command1_Click()
mciSendString “Set CDAudio Door Open Wait”, 0&, 0&, 0&
End Sub

Private Sub Command2_Click()
mciSendString “Set CDAudio Door Closed Wait”, 0&, 0&, 0&
End Sub

To use this code, you will need to declare the mciSendString function, which is included in winmm.dll.

You could declare it this way:

Private Declare Function mciSendString Lib “winmm.dll” Alias “mciSendStringA” (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following