Open CD Drive
Open or close your CD/DVD drive by clicking once in a button of a program made by you in VB6. Its very simple just 8 lines code.
Just add three buttons in your VB6 form. Choose the name as “cmdOpen“, “cmdClose” and “cmdExit“. Now in the cmdOpen button write down the following code :
mciSendString “set CDAudio door open”, 0, 127, 0
And in cmdClose write down this code:
mciSendString “set CDAudio door closed”, 0, 127, 0
Now write this in the global sector of your code
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
We are in the last part of the programming. Write down Unload Me in the cmdExit. Now run your program by clicking F5 and enjoy.
Download Code here...

No comments:
Post a Comment