Open CD Drive
Posted: Wed Aug 04, 2010 6:01 pm
Hello
This tutorial will tell you how to open and close CD Drive with a simple code.
Ok, so under public class <form name> add this code:
The project includes some images
that i got from the internet
Project Download Link: Codexvid
This tutorial will tell you how to open and close CD Drive with a simple code.
Ok, so under public class <form name> add this code:
Code: Select all
And then in your button click event or what ever you are using, add this to the click event:Private setTrayStatus As Long
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
Code: Select all
My laptop doesn't close the CD Drive so i don't know if the close code works... i have to close the drive manually... 'use this code to open the tray
setTrayStatus = mciSendString("Set CDAudio Door Open", Nothing, 0, 0)
'use this code to close the tray
setTrayStatus = mciSendString("Set CDAudio Door Closed", Nothing, 0, 0)
The project includes some images

Project Download Link: Codexvid