CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: cd door open

  1. #1
    Join Date
    Sep 2001
    Location
    MA
    Posts
    11

    cd door open

    Is there an API that will let me check to see if the cd door on a computer is open or closed?


  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: cd door open

    This code will open the door, close the door, and check the CDs status, but I haven't found a way to know if the door is open or not other than assuming from status = false that either the door is open or there is no CD in it...


    option Explicit

    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()
    Dim RetValue as Long
    Dim ReturnString as string
    ReturnString = Space(100)
    RetValue = mciSendString("set CDAudio door open", ReturnString, 100, 0)
    MsgBox RetValue & "-" & ReturnString
    End Sub

    private Sub Command2_Click()
    Dim RetValue as Long
    Dim ReturnString as string
    ReturnString = Space(100)
    RetValue = mciSendString("set CDAudio door closed", ReturnString, 100, 0)
    MsgBox RetValue & "-" & ReturnString
    End Sub

    private Sub Command3_Click()
    Dim RetValue as Long
    Dim ReturnString as string
    ReturnString = Space(100)
    RetValue = mciSendString("status CDAudio ready", ReturnString, 100, 0)
    MsgBox RetValue & "-" & ReturnString
    End Sub





  3. #3
    Join Date
    Nov 2001
    Posts
    1

    Re: cd door open

    Hello,
    I'm interested by this code, but I'dlike to know if it's possible, if I own two CD drives, to open the door I want, and not just the door #1
    Thanks


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured