PDA

View Full Version : How to Insert a CD Drive Tray (WME)



hamidkhan14
02-18-2003, 09:31 AM
First of all Nice to meet You Sir
Would You please write down the scrip to insert the trayof cd drive
thanks

dudeinAmerica
02-24-2003, 03:54 PM
I think I understand your question, you want to close the tray of a CD drive? Alright, well with this script, you can open or close it.

<font color=blue>
Option Explicit

Private Declare Function mciSendString Lib "winmm.dll" _
Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal _
pstrReturnString As String, ByVal uReturnLength As Long, ByVal _
wndCallback As Long) As Long

Public Sub OpenOrShutCDDrive(DoorOpen As Boolean)

Dim lRet As Long

If DoorOpen Then
lRet = mciSendString("Set CDAudio Door Open", 0&, 0&, 0&)
Else
lRet = mciSendString("Set CDAudio door closed", 0&, 0&, 0)
End If

'lRet will = 0 upon success, so if you want to make this
'a function, return true if lret = 0, false otherwise

End Sub
</font color=blue>

Then all you have to do is give the command <font color=blue>OpenOrShutCDDrive (True)</font color=blue> and it will do whichever it needs to. Meaning if it's open, it'll close, and if it's closed, it'll open. Hope this helps you!

/images/forums/icons/cool.gif Brady /images/forums/icons/cool.gif