Code archives/Miscellaneous/Open CD Door

This code has been declared by its author to be Public Domain code.

Download source code

Open CD Door by Vertex2002
Very small code to open the cd-audio-door
Open  = CreateBank(Len("Set CDaudio door open"))
For I = 1 To Len("Set CDaudio door open")
	PokeByte Open,I - 1,Asc(Mid$( "Set CDaudio door open",I,1))
Next 
CallDLL("winmm.dll","mciExecute",Open)

Comments

electronin2004
Awesome! :)


xlsior2004
Any way to specify the drive?

A large # of computers have two of them, after all.
(especially in combination with DVD-ROM and/or CD-RW drives)


Bot Builder2004
cool! why doesn't this work though:

Open  = CreateBank(Len("Set CDaudio door open"))
For I = 1 To Len("Set CDaudio door open")
	PokeByte Open,I - 1,Asc(Mid$( "Set CDaudio door open",I,1))
Next
Close  = CreateBank(Len("Set CDaudio door close"))
For I = 1 To Len("Set CDaudio door close")
	PokeByte Close,I - 1,Asc(Mid$( "Set CDaudio door close",I,1))
Next
Repeat
 If a Then
  CallDLL("winmm.dll","mciExecute",Open)
 Else
  CallDLL("winmm.dll","mciExecute",Close)
 EndIf
 a=1-a
Forever


Is there a different way to do it?


electronin2004
@bot builder - you might need a delay in that loop. it's probably running so fast it doesn't know what to do :)


Anthony Flack2004
WOW! The possibilities for this are almost... er... nonexistent?

;o)


IPete22004
Mr Flack...

Do you remember a programme called "Abuse"?

This sort of capability would be really good for that 'game.

In case you didnt you had to verbally (by typing in) abuse your software - it would parse the incoming text and give you a reply that was at least cutting and often very rude and abusive.

On of the things it did was appear to shut your computer down, with the above you could perhaps 'spew' open the CD door and make rude comments about the lack of good music around here or something...

I was funny at the time...for about a minute anyways!

IPete2.


Shambler2004
I used to program several 'Brown trousers' applications that informed the hapless user the hard drive was now being formatted ( with several open/close file commands ).

Who says work isn't fun? ^^


asdfasdf2004
When I try to copy and paste into Blitz3D it says "Error writing to:C:\path\tmp\tmp.bb"


eBusiness2004
Bot Builder, you need to type closed, not close.


rdodson412004
Wow cool, this may not have any practical use, but it could be used in a game. Do you know any other things like this, or where i could find out about them?


electronin2004
Try the microsoft website, http://www.microsoft.com
There's a lot of stuff about system functions that you can access from Blitz there.


sswift2004
This code has a bug.

You forgot to terminate the string with a null.

Increase the size of the bank by 1, and poke a 0 at the end when you're done poking the string into it. Otherwise it is not guaranteed to work all the time, and may result in an error. C strings are a string of characters 1-255, terminated by a 0.


Gavin1112004
USE: games that require the cd to be in to run could now spew open the door and make it easier to put it in. click okay on screen and it closes???


n8r2k2006
um, no one answered xlsior's question, is there any way to specify the drive, my computer happens to have a Cdrw/dvdrw and a CD drive. I want to open the CD drive but it opens the CD/DVD one by default


n8r2k2006
ummmm, hello? anyone? please help.


ANIMAL2006
JUST EASY IT WORKS THATS ALL YA NEED
ANIMAL


jfk EO-111102006
Well how about this: your horror shocker game becomes veery silent, you know that kind of silence that makes you know something horrible's gonna happen next... and then "gwwwwwwwtt!" just from over there!

Then the game should use this "ahh, it was only the cat" effect to attack the player one second later from the other side with something really horrible and a full orchestra hit.

Makes me rememer how shocking it sometimes is when a webpage is trying to read an image from floppy drive A. Ratatata!


5t@nKy2006
Makes me rememer how shocking it sometimes is when a webpage is trying to read an image from floppy drive A. Ratatata!

-It aint ya floppy its ur hard disk o0


blade0072007
LOL! THIS CODE WOULD BE AWSOME FOR AN APRIL FOOLS DAY VIRUS!!


Ked2007
LOL! THIS CODE WOULD BE AWSOME FOR AN APRIL FOOLS DAY VIRUS!!

There's something you let everyone else know.


XtremeCoder2008
Revised, fully working version

Open = CreateBank(Len("Set CDaudio door open"))
For I = 1 To Len("Set CDaudio door open")
PokeByte Open,I - 1,Asc(Mid$( "Set CDaudio door open",I,1))
Next
Close = CreateBank(Len("Set CDaudio door closed"))
For I = 1 To Len("Set CDaudio door closed")
PokeByte Close,I - 1,Asc(Mid$( "Set CDaudio door closed",I,1))
Next
a=1
Repeat
If a = 1 Then
CallDLL("winmm.dll","mciExecute",Open)
a=0
Else
CallDLL("winmm.dll","mciExecute",Close)
a=1
EndIf
Delay 2000
Forever


xhacks2009
or with buttons it could be:

Open = CreateBank(Len("Set CDaudio door open"))
For I = 1 To Len("Set CDaudio door open")
PokeByte Open,I - 1,Asc(Mid$( "Set CDaudio door open",I,1))
Next
Close = CreateBank(Len("Set CDaudio door closed"))
For I = 1 To Len("Set CDaudio door closed")
PokeByte Close,I - 1,Asc(Mid$( "Set CDaudio door closed",I,1))
Next

Parent = CreateWindow("CDopen/close", 0, 0, 150, 80, 0, 1)
opencd = CreateButton ("Open", 5, 6, 134, 18, Parent, 1)
closecd = CreateButton ("Close", 5, 26, 134, 18, Parent, 1)



Repeat

Select WaitEvent()
Case $803: End
Case $401
Select EventSource()
Case opencd
CallDLL("winmm.dll","mciExecute",Open)
Case closecd
CallDLL("winmm.dll","mciExecute",Close)
End Select
End Select
Forever


Code Archives Forum