Click to See Complete Forum and Search --> : Open and Close CD Drive


Screaming Fist
May 30th, 1999, 03:56 AM
How do I open and close the CD Drive?

--
Screaming Fist
A witty saying proves nothing.

Brian
May 30th, 1999, 07:33 AM
I can't remember where I stole (er, uh, found) this code from, but I hope it helps.


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

public ReturnString as string

public Sub OpenCD()
ReturnString = string$(128, " ")
mciSendString "set CDAudio door open", ReturnString, 127, 0
End Sub

public Sub CloseCD()
ReturnString = string$(128, " ")
mciSendString "set CDAudio door closed", ReturnString, 127, 0
End Sub