How do you eject the cd rom drive?

  • 19 years ago

    and I'm not talking about pressing the button on it


    thanks

  • 19 years ago

    Try this:


    Open/Close The CD Drive


    'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
    'Add 2 CommandButtons to your form (named Command1 and Command2).
    'When you press the first button the CD drive will opened.
    'When you press the second button the CD drive will closed.
    'Insert this code to the module :


    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


    'Insert the following code to your form:


    Private Sub Command1_Click()
    retvalue = mciSendString("set Cdaudio door open", returnstring, 127, 0)
    End Sub


    Private Sub Command2_Click()
    retvalue = mciSendString("set Cdaudio door closed", returnstring, 127, 0)
    End Sub


    Hope this helps - John

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer Science is no more about computers than astronomy is about telescopes.” - E. W. Dijkstra