Tip

Control your CDROM drive with a button

This code opens and closes the CDROM Driver with a button.

1. Create two buttons with the name "open" and "close" 2.Place this script under Declarations=>> 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 3.Place this script under the "click event of the "open" button=>> retvalue = mcisendstring("set CDAudio door open", _ returnstring, 127, 0) 4.Place this under the "click" event of the "close" button retvalue = mcisendstring("set CDAudio door closed", _ returnstring, 127, 0)

This was first published in August 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.