VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Close/open the CD Rom door

by Visual Basic On Line User Group (1 Submission)
Category: Windows System Services
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

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!

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

Rate Close/open the CD Rom door


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

Download this snippet    Add to My Saved Code

Close/open the CD Rom door Comments

No comments have been posted about Close/open the CD Rom door. Why not be the first to post a comment about Close/open the CD Rom door.

Post your comment

Subject:
Message:
0/1000 characters