dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: OPENING & CLOSING CD ROM DRIVE

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    OPENING & CLOSING CD ROM DRIVE

    [Originally posted by tango]

    Hello there
    the code for opening and closing CD Rom drive works sometimes but not always can u please help
    I am using MCISENDSTRING API to perform my task
    Thank u

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:OPENING & CLOSING CD ROM DRIVE

    [Originally posted by Ales Zigon]

    Hi!

    I'm usin it too and it works fine. How do you declare it? Try this way:

    'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
    'Add 2 CommandButtons to your form (named Command1 and Command2).
    'When you press the first button the CD drive will opened.
    'When you press the second button the CD drive will closed.
    'Insert this code to the module :
    Public 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

    'Insert the following code to your form:
    Private Sub Command1_Click()
    retvalue = mciSendString("set Cdaudio door open", returnstring, 127, 0)
    End Sub

    Private Sub Command2_Click()
    retvalue = mciSendString("set Cdaudio door closed", returnstring, 127, 0)
    End Sub


    Regards!
    Ales Zigon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center