Connecting Tech Pros Worldwide Help | Site Map

Opening and Closing CD TRAY

  #1  
Old February 25th, 2008, 10:15 AM
Ali Rizwan's Avatar
Banned
 
Join Date: Aug 2007
Location: Lahore Pakistan
Posts: 929
Hi all,

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


Expand|Select|Wrap|Line Numbers
  1. 'add this lines of code in the declaration section of a standard module.
  2.  '---------------
  3. Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
  4. (ByVal lpszCommand As String, ByVal lpszReturnString As String, _
  5. ByVal cchReturnLength As Long, ByVal hwndCallback As Long) As Long
  6. '--------------
  7.  
  8. 'Now in the module also declare this
  9. '-----------------------------------
  10.  Sub opencd()
  11.      Call mciSendString("set CDAudio door open", 0, 0, 0)
  12.     End Sub
  13.  
  14. Sub closecd()
  15.    Call mciSendString("set CDAudio door closed", 0, 0, 0)
  16.     End Sub
  17. '-----------------------------------
  18. 'Now add two command buttons to the form ( its obvious what i have taken below)
  19. '-----------------------------------
  20. Private Sub Command1_Click()
  21. Call Module1.opencd
  22. End Sub
  23.  
  24. Private Sub Command2_Click()
  25. Call Module1.closecd
  26. End Sub
  27. '----------------------------------
Regards
>> ALI <<

Last edited by debasisdas; February 27th, 2008 at 09:15 AM. Reason: added code=vb tags



  #2  
Old March 22nd, 2008, 11:49 AM
VladicaJ's Avatar
Banned
 
Join Date: Mar 2008
Location: Macedonia - Kumanovo
Posts: 15

re: Opening and Closing CD TRAY


If your want here it is. COMMONT: good code. I use in some of my programs
  #3  
Old March 29th, 2008, 07:29 PM
Banned
 
Join Date: Mar 2008
Posts: 18

re: Opening and Closing CD TRAY


Very useful and very good
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eject the CD/DVD tray Joe Cool answers 3 February 27th, 2006 11:55 PM