CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Location
    MD, USA
    Posts
    35

    Open and Close CD Drive

    How do I open and close the CD Drive?

    --
    Screaming Fist
    A witty saying proves nothing.

  2. #2
    Join Date
    May 1999
    Posts
    7

    Re: Open and Close CD Drive

    I can't remember where I stole (er, uh, found) this code from, but I hope it helps.


    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

    public ReturnString as string

    public Sub OpenCD()
    ReturnString = string$(128, " ")
    mciSendString "set CDAudio door open", ReturnString, 127, 0
    End Sub

    public Sub CloseCD()
    ReturnString = string$(128, " ")
    mciSendString "set CDAudio door closed", ReturnString, 127, 0
    End Sub





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