article

Open_Close_CD_Explained

Email
Submitted on: 1/1/2015 2:59:00 PM
By: Jason Myerscough (from psc cd)  
Level: Intermediate
User Rating: By 5 Users
Compatibility: Delphi 7, Delphi 6, Delphi 5
Views: 1583
 
     This is a break down tutorial explaining how to open and close the Cd rom.

 
				The program is too short to upload so i thought it would be better to create a tutorial :P


Before you can make the CD open or close you have to add MMSYSTEM to the uses section of the code. The function used to open the CD is MciSendString; The function takes for arguments which are: lpszCommand: This command is need to tell the function what to do lpszReturnString: This holds the string returned by the command cchReturn: The size argument is the size of the return string. hwndCallback: is the window that called texecuted the command ie the form. Since we dont want the function to return anything we want it to perform a task we set "lpszReturnString" to nil and "cchReturn" to 0 The command to open the CD is "Set CDAudio Door Open" The command to close the CD is the same apart from you change 'Open' to 'Closed'

Open/close CD
MciSendString('Set CDAudio Door Open', nil, 0, form1.Handle);
MciSendString('Set CDAudio Door Closed', nil, 0, form1.Handle);
Rate The tutorial, if not for the content then for the se of html tables :D - MyerSoft site comming soon


Other 9 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.