hi eveyone ,
Am not gettin time to study from books .I am tryin to generate a code for
CD Drive.
i wanna on a single click it should open the drive and on next command itshould close the drive too.
Anyone give me suggustions how to do????????
specially my old frnds
regards
suneel

Hi Suneel,

Open CD WORKS FINE, BUT Close CD does noty work on all types of CD Readerss. It works only for those CD Readers which has got the functionality to close thru codes. any way u can try this code:

declare this at the top of form

Private 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
Private Sub cmdOpen_Click()
    Dim i
    i = mciSendString("set cd door open wait", 0&, 0, 0)

End Sub
Private Sub cmdClose_Click()
    Dim i
    i = mciSendString("set cd door closed wait", 0&, 0, 0)

End Sub

Regards
Veena

hi Veena
i have added 2 command buttons open and close ok then pasted ur code but not wokin its not givin error also.reply soon
Cd Drive is not comin out ok.if any files to be added throught project referenceds or components plz tell me .
reply soon
regards
suneel

Hi,

did u copy the API on the top of form and rename the command buttons: cmdOpen, cmdClose....?

REgards
Veena

yes i have done that ok .hey sendin u the code ok just check that out ok.check gmail .
tc.regards
suneel

hi vee
any project refereces or components i have to add then plz tell me .
regards
suneel

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.