Click to See Complete Forum and Search --> : cd door open


mbw
October 24th, 2001, 11:04 AM
Is there an API that will let me check to see if the cd door on a computer is open or closed?

DSJ
October 24th, 2001, 03:10 PM
This code will open the door, close the door, and check the CDs status, but I haven't found a way to know if the door is open or not other than assuming from status = false that either the door is open or there is no CD in it...


option Explicit

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 Command1_Click()
Dim RetValue as Long
Dim ReturnString as string
ReturnString = Space(100)
RetValue = mciSendString("set CDAudio door open", ReturnString, 100, 0)
MsgBox RetValue & "-" & ReturnString
End Sub

private Sub Command2_Click()
Dim RetValue as Long
Dim ReturnString as string
ReturnString = Space(100)
RetValue = mciSendString("set CDAudio door closed", ReturnString, 100, 0)
MsgBox RetValue & "-" & ReturnString
End Sub

private Sub Command3_Click()
Dim RetValue as Long
Dim ReturnString as string
ReturnString = Space(100)
RetValue = mciSendString("status CDAudio ready", ReturnString, 100, 0)
MsgBox RetValue & "-" & ReturnString
End Sub

Hoggins!
November 29th, 2001, 03:19 PM
Hello,
I'm interested by this code, but I'dlike to know if it's possible, if I own two CD drives, to open the door I want, and not just the door #1
Thanks