Important alert: (current site time 7/15/2013 3:47:44 PM EDT)
 

VB icon

Cdopener

Email
Submitted on: 6/26/1999
By: Jon Boyce  
Level: Not Given
User Rating: By 4 Users
Compatibility: Java (JDK 1.1)
Views: 25063
author picture
(About the author)
 
     Opens and closes a cd tray
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: Cdopener
// Description:Opens and closes a cd tray
// By: Jon Boyce
//
// Assumes:This code is actually visual j++ the package com.ms.win32 is not part of the java api and is not standard sun code.!!!!!!!!!!
//
// Side Effects:You need a very up to date virual machine to interpret the java bytecode otherwise the code will not work, ie5 has a very good up to date virtual machine, i highly recomend this as it will make life a lot easier
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=1659&lngWId=2//for details.//**************************************

import com.ms.win32.*;
public class Cdopener
{
	private static String OPEN = "set cdaudio door open";
	private static String CLOSE = "set cdaudio door open";
	private static final int MAX_ERROR_SIZE = 64;
	private static StringBuffer sbreturn = new StringBuffer(MAX_ERROR_SIZE);
	
	public static void main (String[] args)
	{
		//call open() to open it and close() in the main method to
//close it
	}
	
	public static void open()
	{
	 Winmm.mciSendString(OPEN,sbreturn,127,0);		
	}
	
	public static void close()
	{
	 Winmm.mciSendString(CLOSE,sbreturn,127,0);		
	}
}


Other 5 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 code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
5/7/2002 10:35:59 AMroman

i would like to see this code using java's standard 1.4.1 java api
(If this comment was disrespectful, please report it.)

 
9/14/2002 9:25:07 PM

i must be dumb..how do i incorporate this in to anything and where does it go or whatever.. could you please email me! :) thx.. im@smev.co.uk
(If this comment was disrespectful, please report it.)

 
4/25/2006 4:28:53 AMSHAREKH

hii
i m sharekh,ur code is intresting but u have used j++,so can u please send me java's api functions to use it on a cd or a dvd rom,i will really glad to seek ur help.
thank you
(If this comment was disrespectful, please report it.)

 
6/10/2007 5:48:00 AMsagarkijaan

i want to develope mobiles softwares..........so please guid me..
(If this comment was disrespectful, please report it.)

 
1/15/2009 8:51:29 AMARUZ

Doesnt work wiv JDK1.6...
There is no any package like com.ms.win32
(If this comment was disrespectful, please report it.)

 
5/13/2009 7:08:07 AMJerome Scott II

Whats to link to download the library?
(If this comment was disrespectful, please report it.)

 

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 code, please click here instead.)
 

To post feedback, first please login.