MCI Supports Multiple CD-ROMs

MCI Supports Multiple CD-ROMs

The Media Control Interface (MCI) can easily support multiple CD audio devices.
You simply specify the drive letter in the MCI open command. To eject the CD from any drive,
first place a listbox on a form. To detect which drives are CD-ROMs,
place this code in the form’s General Declarations section:

 Private Declare Function GetDriveType Lib _	"kernel32" Alias "GetDriveTypeA" (ByVal _	nDrive As String) As LongPrivate 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 LongPrivate Const DRIVE_CDROM = 5

The following code in the Form_Load event fills the listbox with available CD-ROM drives.
Note that the code does not detect whether the CD-ROM drive can actually eject the CD.
Use the “capabilities can eject” MCI command to determine that:

 Private Sub Form_Load()	Dim k As Long	For k = Asc("A") To Asc("Z")		If GetDriveType(Chr$(k) & ":") = _			DRIVE_CDROM Then			List1.AddItem Chr$(k) & ":"		End If	NextEnd Sub

Place this code in the List1_DblClick event to eject the CD:

 Private Sub List1_DblClick()	mciSendString "open " & _		List1.List(List1.ListIndex) & _		" type cdaudio alias cdaudio", _		vbNullString, 0, 0	mciSendString "set cdaudio door open", _		vbNullString, 0, 0	mciSendString "close cdaudio", vbNullString, _		0, 0End Sub
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several