VB: CD-ROM (OPEN and CLOSE)

a program created in MS Visual Basic 6.0 that will give an open or a close command to the cd-rom device.

►steps on how to create the code:
1. create a Module1.bas file in VB with the following code:
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

2. create the codes in the form with 2 command buttons for the Open and Close commands

Dim lngReturn As Long
Dim strReturn As Long

Private Sub cmdOpen_Click()
lngReturn = mciSendString("set CDAudio door open", strReturn, 127, 0)
End Sub

Private Sub cmdClose_Click()
lngReturn = mciSendString("set CDAudio door closed", strReturn, 127, 0)
End Sub

_________________________________________________________________
  .  cdo bloggers   .  my digital corner   .  sacha chua   .  the oatmeal   .  toxel.com   . 
  .  Hotels & Resorts Worldwide   .