How do I open and close the Cd using vb code?

I am working on a cool program something like explorer and I wonder who

do I open and close the cd using vb code??


Comments

  • i found this at www.programmerz.com/vb/

    tried it and it works fine!


    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??





Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories