Results 1 to 2 of 2

Thread: Code to open & close CD-Rom with VB

  1. #1

    Thread Starter
    New Member hanysaad's Avatar
    Join Date
    Jan 2006
    Location
    Egypt , Asyut
    Posts
    5

    Lightbulb Code to open & close CD-Rom with VB

    VB Code:
    1. Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" ( _
    2.     ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
    3.     ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
    4.    
    5. Public Sub OpenCDDriveDoor(ByVal State As Boolean)
    6.     If State = True Then
    7.         Call mciSendString("Set CDAudio Door Open", 0&, 0&, 0&)
    8.     Else
    9.         Call mciSendString("Set CDAudio Door Closed", 0&, 0&, 0&)
    10.     End If
    11. End Sub
    12.    
    13. Private Sub Command1_Click()
    14.     OpenCDDriveDoor (True)
    15. End Sub
    16.    
    17. Private Sub Command2_Click()
    18.     OpenCDDriveDoor (False)
    19. End Sub
    Last edited by Hack; May 1st, 2006 at 06:15 AM.
    "THERE IS NO GOD EXCEPT ALLAH, AND MUHAMMED IS HIS MESSENGER "
    Hany Saad Moustaffa .
    Moderator of VB6.0 forum in Arabteam forums.
    Egypt, Asyut.
    Asyut university, faculty of science.
    E-mail : hanysaad_2000@yahoo.com
    My Blog : http://hanysaad.blogspot.com/

  2. #2
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Code to open & close CD-Rom with VB

    I'm sure we all appreciate your code contributions, but please post them in the Codebank
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width