Connecting Tech Pros Worldwide Forums | Help | Site Map

Opening and Closing CD TRAY

Ali Rizwan's Avatar
Banned
 
Join Date: Aug 2007
Location: Lahore Pakistan
Posts: 929
#1   Feb 25 '08
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; Feb 27 '08 at 09:15 AM. Reason: added code=vb tags



VladicaJ's Avatar
Banned
 
Join Date: Mar 2008
Location: Macedonia - Kumanovo
Posts: 15
#2   Mar 22 '08

re: Opening and Closing CD TRAY


If your want here it is. COMMONT: good code. I use in some of my programs
Banned
 
Join Date: Mar 2008
Posts: 18
#3   Mar 29 '08

re: Opening and Closing CD TRAY


Very useful and very good
Reply


Similar Visual Basic 4 / 5 / 6 bytes