What's the command string for ejecting the cd rom using the mciSendString API? Or is a different api used for that?
Thanks,
Neil
Printable View
What's the command string for ejecting the cd rom using the mciSendString API? Or is a different api used for that?
Thanks,
Neil
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