July 23, 2024, 09:24:09 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Controlling the CD Door

Started by GWS, January 24, 2012, 04:48:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GWS

Hi,

Here's a test program based on some original notes by Protected  :) ..

It allows the CD door to be opened and closed.


' Skeleton window

' Opening and Closing the CD Door
' GWS 2012 - (based on a post from Protected) ..

def w:window
def wstyle,i:int

DECLARE "winmm",mciSendStringA(Command:STRING,Returns:STRING,cch:INT,hwnd:int),int

wstyle = @minbox

' open a window ..
window w,0,0,600,300,wstyle,0,"Creative Basic",messages
setwindowcolor w,rgb(0,0,130)
centerwindow w

control w,"B,Exit,(600-70)/2,210,70,30,0,1"
control w,"B,Open CD Door,(600-100)/4,110,100,30,0,2"
control w,"B,Close CD Door,(600-100)/4*3,110,100,30,0,3"

mciSendStringA("open cdaudio wait","",0,0)

run = 1

WAITUNTIL run = 0
mciSendStringA("close cdaudio","",0,0)
CLOSEWINDOW w
END

SUB messages
select @class
case @idclosewindow
run = 0
case @idcontrol
if @controlID = 1 then run = 0
if @controlID = 2 then mciSendStringA("set cdaudio door open","",0,0)
if @controlID = 3 then mciSendStringA("set cdaudio door closed","",0,0)
endselect
RETURN



best wishes, :)

Graham
Tomorrow may be too late ..

AdrianFox

Just like to say thanks for posting all this useful code... some very interesting stuff here which will be very useful. 
:) :)
Adrian Fox

GWS

You're welcome Adrian ..  ;D

My ulterior motive is to show folks how useful Creative Basic can be ..  :P
It still beats most other languages in my opinion - and I've tried them all.

Graham
Tomorrow may be too late ..