README.md

December 4, 2022 ยท View on GitHub

Close/open the CD Rom door

Description

Open and close the CD rom door from code! Note:comment out the unneeded api declaration (16 or 32 bit) depending on what operating system you are using!

More Info

Submitted On
ByVisual Basic On Line User Group
LevelBeginner
User Rating2.8 (11 globes from 4 users)
CompatibilityVB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
CategoryWindows System Services
WorldVisual Basic
Archive File

API Declarations

'for 16 bit windows
Declare Function mcisendstring Lib "MMSystem" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal wReturnLength As Integer, ByVal hCallback As Integer) As Long
'Note:FOR 95/98/NT using the following:
Public 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

Source Code


'to open it:
x=
mciSendString("set cd door open", 0&,
0, 0)
'to close it:
x = mciSendString("set
cd door closed", 0&, 0, 0)