Free Web Hosting Provider - Web Hosting - E-commerce - High Speed Internet - Free Web Page
Search the Web

MW-Menu

 

Free Visual BASIC Newsletter

Features

Tips

Sample Code

Newsletters

Products

ActiveX

Cool Links

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Opening and Closing the CD-ROM Tray

This can be done by using the mciSendString API function, which I have for ease of use renamed to MCI, but to open or close the CD-ROM door use the following function:

Private Declare Function MCI Lib "winmm.dll" Alias _

"mciSendStringA" (ByVal lpstrCommand As String, _

ByVal lpstrReturnString As Any, ByVal uReturnLength _

As Long, ByVal hwndCallback As Long) As Long

Public Enum eState

lOpen = 1

lClosed = 2

End Enum

Public Function CDDoor(lState As eState) As Long

Dim sState As String

If lState = lClosed Then sState = "Closed" Else sState = "Open"

CDDoor = MCI("Set CDAudio Door " & sState, "", 0, 0)

End Function

Call by using

<Success = 0> = CDDoor(<Option>)

If 0 is returned then the drive is now shut or open depending on what

parameter you set.

Home

___________________________________________

Send Bugs, comments to the webmaster at webmaster@mwe.8m.com

Terms of Use

© 1999 MW Software, all rights reserved