AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

How can I open and close the CD-ROM drive?

If you would like to open or close the CD-Rom drive from Visual Basic, you can send a request to the Windows Multimedia DLL with the relevant command.  You have to decare the DLL in your project.

Declarations
Copy this code into the declarations section of a module or form.

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              

Procedure
To open the CD door, use this code:

retvalue = mcisendstring("set CDAudio door open", _
returnstring, 127, 0)

To close the CD door, use this code:

retvalue = mcisendstring("set CDAudio door closed", _
returnstring, 127, 0)

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/