Results 1 to 2 of 2

Thread: Ejecting The CD ROM

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Fredericton, NB, Canada
    Posts
    85

    Ejecting The CD ROM

    What's the command string for ejecting the cd rom using the mciSendString API? Or is a different api used for that?

    Thanks,
    Neil

  2. #2
    jim mcnamara
    Guest
    Code:
    from  M Gates
    
    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 CloseDoor(ByVal DriveLetter As String) 
        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 OpenDoor(ByVal DriveLetter As String) 
        Dim AliasName As String 
        AliasName = "Drive" & DriveLetter 
        mciSendString "Open " & DriveLetter & ": Alias " & AliasName _ 
        & " Type CDAudio", 0, 0, 0 
        mciSendString "Set " & AliasName & " Door Open", 0, 0, 0 
    End Sub
    
    
    Usage
    
    
    Private Sub Command1_Click() 
        Call OpenDoor(Left(Drive1.Drive, 2)) 
    End Sub 
    
    Private Sub Command2_Click() 
        Call CloseDoor(Left(Drive1.Drive, 2))
    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