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
Private Sub Command1_Click()
Static bOpen As Boolean
Dim strStr As String
If Not bOpen Then
Screen.MousePointer = vbHourglass
strStr = "set CDAudio door open"
Command1.Caption = "关闭"
Else
Screen.MousePointer = vbHourglass
strStr = "set CDAudio door closed"
Command1.Caption = "打开"
End If
Call mciSendString(strStr, vbNull, 127, 0)
Screen.MousePointer = vbDefault
DoEvents
bOpen = Not bOpen
End Sub