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 Vertex
(Posted 24 years ago)
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

electronin
(Posted 23 years ago)
Awesome! :)

xlsior
(Posted 23 years ago)
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 Builder
(Posted 23 years ago)
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?

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

Anthony Flack
(Posted 23 years ago)
WOW! The possibilities for this are almost... er... nonexistent?

;o)

IPete2
(Posted 23 years ago)
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.

Shambler
(Posted 23 years ago)
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? ^^

Adren Software
(Posted 23 years ago)
When I try to copy and paste into Blitz3D it says "Error writing to:C:\path\tmp\tmp.bb"

eBusiness
(Posted 23 years ago)
Bot Builder, you need to type closed, not close.

rich d
(Posted 23 years ago)
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?

electronin
(Posted 23 years ago)
Try the microsoft website, http://www.microsoft.com
There's a lot of stuff about system functions that you can access from Blitz there.

sswift
(Posted 23 years ago)
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.

Gavin111
(Posted 23 years ago)
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???

n8r2k
(Posted 21 years ago)
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

n8r2k
(Posted 21 years ago)
ummmm, hello? anyone? please help.

ANIMAL
(Posted 21 years ago)
JUST EASY IT WORKS THATS ALL YA NEED
ANIMAL

jfk EO-11110
(Posted 21 years ago)
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@nKy
(Posted 21 years ago)
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

blade007
(Posted 19 years ago)
LOL! THIS CODE WOULD BE AWSOME FOR AN APRIL FOOLS DAY VIRUS!!

Ked
(Posted 19 years ago)
LOL! THIS CODE WOULD BE AWSOME FOR AN APRIL FOOLS DAY VIRUS!!

There's something you let everyone else know.

XtremeCoder
(Posted 19 years ago)
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

xhacks
(Posted 18 years ago)
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