Results 1 to 3 of 3

Thread: Ejecting the CD

  1. #1

    Thread Starter
    Addicted Member Mage33's Avatar
    Join Date
    Aug 2000
    Location
    Petaluma, California
    Posts
    138

    Arrow

    Bah, what's the API call that ejects/pulls in the CD Rom's drive? I've had it before but I can't remember.
    Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
    -ShardsOfSilence.net- ^ My name in ASCII ^
    You forget something new every day
    | WinME | VB6 Pro | MSC++ | Lambda MOO |

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'Open and close the cd door 
    
    Option Explicit 
    
    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 
    
    '=============================================================== 
    
    'To open the CD door, use this code: 
    
    retvalue = mcisendstring("set CDAudio door open", _ 
    returnstring, 127, 0) 
    
    'To close the CD door, use this code: 
    
    retvalue = mcisendstring("set CDAudio door closed", _ 
    returnstring, 127, 0)
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Lively Member stever2003's Avatar
    Join Date
    Dec 2000
    Posts
    109

    Exclamation

    The code listed above didn't work for me but this code does:

    Code:
        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 CloseCDDoor(ByVal DriveLetter As String)
        'This will close the specified cd-rom drive.  e.g.  Call CloseCDDoor("e")
        Dim AliasName As String
        AliasName = "Drive" & DriveLetter
        mciSendString "open " & DriveLetter & ": Alias " & AliasName _
        & " Type CDAudio", 0, 0, 0
        mciSendString "Set " & AliasName & " door Closed", 0, 0, 0
    End Sub
    
    Private Sub OpenCDDoor(ByVal DriveLetter As String)
        'This will open the specified cd-rom drive.  e.g.  Call OpenCDDoor("e")
        Dim AliasName As String
        AliasName = "Drive" & DriveLetter
        mciSendString "eject " & DriveLetter & ": Alias " & AliasName _
        & " Type CDAudio", 0, 0, 0
        mciSendString "Set " & AliasName & " door open", 0, 0, 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