Open/eject CD

G

Guest

Hi Thanks in advance.

Would like a VBA command that opens/ejects the CD.

It is possible.

If so how.

Thanks

Trev
 
G

Graham R Seach

Trever,

Courtesy of http://www.delphifaq.com/faq/f614.shtml

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 Sub cmdOpenCD_Click()
Dim lRet As Long, returnstring As String
lRet = mciSendString("set CDAudio door open", returnstring, 127, 0)
End Sub

Public Sub cmdCloseCD_Click()
Dim lRet As Long, returnstring As String
lRet = mciSendString("set CDAudio door closed", returnstring, 127, 0)
End Sub


Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top