Make a new project. To the form add two command buttons.
Code:Add this code to the form's General Declarations procedure:
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
Add this code to the first command button:(Open)
Private Sub Command1_Click()retvalue = mciSendString("set CDAudio door open", _returnstring, 127, 0)End Sub
Add this code to the second command button:(Close)
Private Sub Command2_Click()retvalue = mciSendString("set CDAudio door closed", _returnstring, 127, 0)End Sub
>: I am working on a cool program something like >explorer and I wonder who >: do I open and close the cd using vb code??
It looks like you're new here. If you want to get involved, click one of these buttons!