Opening and Closing CD TRAY

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    Opening and Closing CD TRAY

    Hi all,

    Here is a simple used to Open and Close CD TRAY.
    Comment it PLEASE!


    [CODE=vb]'add this lines of code in the declaration section of a standard module.
    '---------------
    Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA " _
    (ByVal lpszCommand As String, ByVal lpszReturnStrin g As String, _
    ByVal cchReturnLength As Long, ByVal hwndCallback As Long) As Long
    '--------------

    'Now in the module also declare this
    '-----------------------------------
    Sub opencd()
    Call mciSendString(" set CDAudio door open", 0, 0, 0)
    End Sub

    Sub closecd()
    Call mciSendString(" set CDAudio door closed", 0, 0, 0)
    End Sub
    '-----------------------------------
    'Now add two command buttons to the form ( its obvious what i have taken below)
    '-----------------------------------
    Private Sub Command1_Click( )
    Call Module1.opencd
    End Sub

    Private Sub Command2_Click( )
    Call Module1.closecd
    End Sub
    '----------------------------------[/CODE]

    Regards
    >> ALI <<
    Last edited by debasisdas; Feb 27 '08, 09:15 AM. Reason: added code=vb tags
  • VladicaJ
    Banned
    New Member
    • Mar 2008
    • 15

    #2
    If your want here it is. COMMONT: good code. I use in some of my programs

    Comment

    • BorlandDelphi
      Banned
      New Member
      • Mar 2008
      • 18

      #3
      Very useful and very good

      Comment

      Working...