Jump to content

Cd tray


ihackwindows
 Share

Recommended Posts

loop the open or loop like it's closing and opening?
good question, wtf is the loop about ?

if it's just stuck with a cd inside , just find the small hole inthe front and stick like a toothpick or a end of a paperclip in it, and press.

the tray should click open, then just slowly pull open the drive ...

Link to comment
Share on other sites

I think that nircmd will do the trick (opening / closing the cd tray via command line / batch script)

If in fact that was what you were after, http://www.nirsoft.net/utils/nircmd.html

as for looping it, why on earth would you want to do that???

if you must, throw the following code in a .bat file & run it, you'll either need to Ctrl+C or kill the process / close it to stop :P  (and i presume this could be used in a semi-skiddie manner?)

:START
nircmd cdrom open
nircmd cdrom close
goto START

Link to comment
Share on other sites

I remember back in the day you would go to a web page and it would ask if you wanted a free cup holder. When you clicked the link, it would eject your cd tray, but you had to have Windows Media Player 7, Javascript and or VBScript turned on and use Internet Explorer for it to work. The script still works, but most users on here use FF or Opera, so it won't work because it calls active-x commands.

I found some older examples of the code to mess with if you want to use it just to learn basic scripting:

http://www.its.caltech.edu/~xuanluo/opencdjs.html

http://www.its.caltech.edu/~xuanluo/opencdvb.html

http://www.its.caltech.edu/~xuanluo/opencdns.html

You can make a small VB app(or whatever language you prefer) to do it as well, but it is pretty useless unelss you just wanted to begin programing in windows.

Link to comment
Share on other sites

Since this is going to go no where until the guy gets some code here it goes.

Look around on MSDN... pretend the funcs CDtray lets say.

for(;;){
CDtray("F:", "open");
sleep(1337);
CDtray("F:", "close");
}

Also I highly suggest you do not try to code anything until you learn how to program (I suggest C++)... if you do not know how to loop something then you obviously have no clue how to program.

Link to comment
Share on other sites

Since this is going to go no where until the guy gets some code here it goes.

Look around on MSDN... pretend the funcs CDtray lets say.

for(;;){
CDtray("F:", "open");
sleep(1337);
CDtray("F:", "close");
}

Also I highly suggest you do not try to code anything until you learn how to program (I suggest C++)... if you do not know how to loop something then you obviously have no clue how to program.

"if you do not know how to loop something then you obviously have no clue how to program."

I find that funny cos you did the worst infinate loop you can do in C++.

Link to comment
Share on other sites

Also I highly suggest you do not try to code anything until you learn how to program (I suggest C++)... if you do not know how to loop something then you obviously have no clue how to program.

why?

So he can have a clue about what he is doing and not be confused.

Since this is going to go no where until the guy gets some code here it goes.

Look around on MSDN... pretend the funcs CDtray lets say.

for(;;){
CDtray("F:", "open");
sleep(1337);
CDtray("F:", "close");
}

Also I highly suggest you do not try to code anything until you learn how to program (I suggest C++)... if you do not know how to loop something then you obviously have no clue how to program.

"if you do not know how to loop something then you obviously have no clue how to program."

I find that funny cos you did the worst infinate loop you can do in C++.

I love for loops  :-P

Link to comment
Share on other sites

Sigh

And K1u, the question wasn't about the loop, it was about the function to call to get it to eject. When you program in C, and you want a CDtray function to open or close based on the last parameter, you make that parameter a numeric value and define valid constants for the numeric value in a header file. Similarly, the drive letter should just be that: a letter. A single char is plenty.

Link to comment
Share on other sites

Sigh

And K1u, the question wasn't about the loop, it was about the function to call to get it to eject. When you program in C, and you want a CDtray function to open or close based on the last parameter, you make that parameter a numeric value and define valid constants for the numeric value in a header file. Similarly, the drive letter should just be that: a letter. A single char is plenty.

Hmmm... I didn't know about DeviceIoControl(). I'm assuming mciSendString() is just a wrapper for it and a few other functions.

Who needs a loop anyway?  All you have to do is turn on auto eject. which will continuously eject the tray even after the program closes.  In the MSDN blog post i linked to earlier it cleverly disguises the program as a web accelerator, while secretly ejects the cd tray at random intervals.

Link to comment
Share on other sites

Sigh

And K1u, the question wasn't about the loop, it was about the function to call to get it to eject. When you program in C, and you want a CDtray function to open or close based on the last parameter, you make that parameter a numeric value and define valid constants for the numeric value in a header file. Similarly, the drive letter should just be that: a letter. A single char is plenty.

Sorry then my friend.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...