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

How to Control CD Drive operation? 2

Status
Not open for further replies.

zjlu2715

Programmer
Apr 5, 2002
23
US
Is there any way one can control CD or CDRW drive such as Eject CD or eject CDR & leave data in original format and so on. I'd like to provide a function in my code to do what EasyCD Creator does where I can click on the icon in system tray to eject a CDR.
 
Try this:

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

Private Sub cmdTrayOut_Click()
x = mciSendString("set CDAudio door open", 0&, 0, 0)
End Sub

Private Sub cmdTrayIn_Click()
x = mciSendString("set CDAudio door closed", 0&, 0, 0)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top