|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Im doing a project at school and i will really
appreciate it if anybody could help.I cant figure out how to open the cd drive with Java programing.Please write back as soon as possible at maceve@sisd.net |
|
#2
|
|||
|
|||
|
"
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 tra // y // 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 da // te virual machine to interpret the java // bytecode otherwise the code will not wor // k, ie5 has a very good up to date virtua // l 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.1JavaStreet.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); } } " from http://www.1javastreet.com/vb/scrip...d=1659&lngWId=2 seems like it would work, but you would need to get the nonstandard package it needs. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > How to open the CD drive with Java programming |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|