Source wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
CD-Player (fertiges Programm)
Autor: Angelo Sandoli
Programm: CDPLAYER
Version: 1.00
letzte Änderung: 99-05-29
$O-
Def GetWindowLong(2) !USER32,GetWindowLongA
Def SetWindowLong(3) !USER32,SetWindowLongA
Def CreateStatusBar(4) !COMCTL32,CreateStatusWindowA
Def CalcLeft(1) Int(Div(Sub(%MaxX,@%(1)),2))
Def CalcTop(1) Int(Div(Sub(%MaxY,@%(1)),2))
Proc Set3DBorder
Parameters hw%,a%,b%,c%,d%
Inc c%
SetWindowLong(hw%,-20,Or(GetWindowLong(hw%,-20),$200))
SetWindowPos hw%=a%,b%-c%,d%
EndProc
Def ReleaseCapture(0) !USER32,ReleaseCapture
Def GetSysColor(1) !USER32,GetSysColor
declare ende%,Button1%,Button2%,Button3%,Button4%,Button5%,Button6%,Button7%,Button8%
declare Button9%,Button10%,Button11%,Button12%,Edit1%,Edit2%,MultiEdit1%,Buttonplay%,ButtonStop%
declare ButtonPause%,verlauf%
declare statusbutton%,buttonzahl$,track$,statuspause%,edit3%,edit4%,edit5%,edit6%
declare bvor%,bback%,atrack$,atrack%,cbox%,bsvor%,bsback%,bcddoor%,statuston%
declare bmodus%,zzahl$,statusmodus%,zzahl%
proc ende
declare ebutton%
ebutton%=MessageBox((: Soll ich mich wirklich beenden :),Kleine Frage, große Wirkung,36)
case equ(ebutton%,6):ende%=1
endproc
Proc CreateMainMenu
appendmenubar 100,&Ende
appendmenubar 101,&Info
appendmenubar 102,&MCI Befehlseingabe
EndProc
declare dialog%,dedit%,dbutton%,statusmciwindow%,dlistb%,dbende%
proc mci
windowstyle 80 $0050 80
dialog%=createdialog(%hwnd,MCI Befehlseingabe,50,50,493,220)
dedit%=createedit(dialog%,,2,8,390,20)
dbutton%=createbutton(dialog%,OK,410,10,45,20)
dlistb%=createlistbox(dialog%,,5,50,470,110)
dbende%=createbutton(dialog%,Fenster schliessen,35,170,400,20)
movelisttolist(dlistb%)
setfocus(dedit%)
statusmciwindow%=1
endproc
proc zufall
clear zzahl%,zzahl$
zzahl%=rnd(sub(val(mcisend$(status cd number of tracks)),1))
inc zzahl%
zzahl$=zzahl%
endproc
seterrorlevel 0
decimals 0
settruecolor 1
windowstyle $030A
windowstyle 522
windowtitle CD Player Ver. 1.00
window calcleft(493),calctop(245)-493,245
set3dborder %hwnd,calcleft(493),calctop(245),493,245
UseFont MS Sans Serif,13,0,1,0,0
useicon Windows
SetDialogFont 1
CreateMainMenu
cls rgb(192,192,192)
Button1%=createbutton(%hwnd,1,10,10,22,22)
Button2%=createbutton(%hwnd,2,40,10,22,22)
Button3%=createbutton(%hwnd,3,70,10,22,22)
Button4%=createbutton(%hwnd,4,10,40,22,22)
Button5%=createbutton(%hwnd,5,40,40,22,22)
Button6%=createbutton(%hwnd,6,70,40,22,22)
Button7%=createbutton(%hwnd,7,10,70,22,22)
Button8%=createbutton(%hwnd,8,40,70,22,22)
Button9%=createbutton(%hwnd,9,70,70,22,22)
Button10%=createbutton(%hwnd,0,40,100,22,22)
Button11%=createbutton(%hwnd,1..,10,100,22,22)
Button12%=createbutton(%hwnd,2..,70,100,22,22)
bback%=createbutton(%hwnd,Track <,150,145,70,20)
bvor%=createbutton(%hwnd,> Track,255,145,70,20)
edit1%=control(EDIT,,$50400001,120,30,102,21,%hwnd,0,%HINSTANCE)
edit2%=control(EDIT,,$50400001,250,30,102,21,%hwnd,0,%HINSTANCE)
edit3%=control(EDIT,,$50400001,120,70,102,21,%hwnd,0,%HINSTANCE)
edit4%=control(EDIT,,$50400001,250,70,102,21,%hwnd,0,%HINSTANCE)
edit5%=control(EDIT,,$50400001,120,110,102,21,%hwnd,0,%HINSTANCE)
edit6%=control(EDIT,,$50400001,250,110,102,21,%hwnd,0,%HINSTANCE)
Buttonplay%=createbutton(%hwnd,Play,380,20,75,25)
ButtonStop%=createbutton(%hwnd,Stop,380,60,75,25)
ButtonPause%=createbutton(%hwnd,Pause,380,100,75,25)
cbox%=createcheckBox(%hwnd,Ton aus,20,172,70,15)
bsback%=createbutton(%hwnd,<<,170,170,30,20)
bsvor%=createbutton(%hwnd,>>,275,170,30,20)
bcddoor%=createbutton(%hwnd,CD-Door,340,155,60,20)
bmodus%=createbutton(%hwnd,Normal,410,165,55,20)
drawlibicon add$($winpath,\sndvol32.exe),1,40,135
textcolor rgb(0,0,0),-1
drawtext 128,14,aktueller Titel:
drawtext 122,55,aktuelle Position:
drawtext 140,95,Länge CD:
drawtext 266,14,Anzahl Titel:
drawtext 269,55,Länge Titel:
drawtext 274,95,Status CD:
textcolor rgb(0,0,0),-1
drawtext 415,145,Modus:
randomize
clearlist
@mcisend$(open cdaudio alias cd)
addstring opend cdaudio alias cd
if %mcierror
MessageBox(Fehler beim initialisieren des CD-ROM Laufwerkes,
das CD-ROM Laufwerk wird bereits verwendet,
Programm wird beendet,Fehlermeldung,48)
end
endif
mcisend$(set cd time format tmsf)
addstring set cd time format tmsf
settext edit1%,mcisend$(status cd current track)
addstring status cd current track
settext edit2%,mcisend$(status cd number of tracks)
addstring status cd number of tracks
settext edit3%,mid$(mcisend$(status cd position),4,5)
addstring mid$(mcisend$(status cd position),4,5)
settext edit4%,mcisend$(STATUS CD LENGTH TRACK 1)
addstring STATUS CD LENGTH TRACK 1
settext edit5%,mcisend$(status cd length)
addstring status cd length
settext edit6%,mcisend$(status cd mode)
addstring status cd mode
mcisend$(play cd from 1)
addstring play cd from 1
settimer 800
atrack$=1
buttonzahl$=0
zzahl$=
zzahl%=0
statusmodus%=0
statuspause%=0
statusbutton%=0
statusmciwindow%=0
statuston%=0
ende%=0
whilenot ende%
getmessage
if mouse(40,135-70,165)
case equ(%mousekey,1): winexec(add$($winpath,\sndvol32.exe),1)
elseif equ(getcheck(cbox%),0)
if statuston%
mcisend$(set cd audio all on)
addstring set cd audio all on
statuston%=0
case statusmciwindow%: @AddString(dlistb%,set cd audio all on)
endif
elseif getcheck(cbox%)
ifnot statuston%
mcisend$(set cd audio all off)
addstring set cd audio all off
statuston%=1
case statusmciwindow%: @AddString(dlistb%,set cd audio all off)
endif
endif
If Equ(%message,$201)
UseCursor 5
Sendmessage(%hwnd,$0112,$0F012,0)
UseCursor 0
ReleaseCapture()
endif
if %wmtimer
settext edit1%,mcisend$(status cd current track)
settext edit2%,mcisend$(status cd number of tracks)
settext edit3%,mid$(mcisend$(status cd position),4,5)
settext edit4%,mcisend$(add$(STATUS CD LENGTH TRACK ,mcisend$(status cd current track)))
settext edit5%,mcisend$(status cd length)
settext edit6%,mcisend$(status cd mode)
endif
waitinput
if getfocus(dbende%)
destroywindow(dialog%)
statusmciwindow%=0
endif
if equ(2,%key)
ende
elseif menuitem(100)
ende
elseif menuitem(101)
MessageBox(createt by Angelo Sandoli,CD Player,64)
elseif menuitem(102)
if equ(statusmciwindow%,0)
mci
elseif equ(statusmciwindow%,1)
destroywindow(dialog%)
statusmciwindow%=0
endif
elseif menuitem(254)
MessageBox(createt by Angelo Sandoli,CD Player,64)
elseif getFocus(Button1%)
if equ(statusbutton%,0)
atrack$=1
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
if neq(statusbutton%,0)
atrack$=add$(buttonzahl$,1)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
elseif getFocus(Button2%)
if equ(statusbutton%,0)
atrack$=2
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
if neq(statusbutton%,0)
atrack$=add$(buttonzahl$,2)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
elseIf getFocus(Button3%)
if equ(statusbutton%,0)
atrack$=3
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
If neq(statusbutton%,0)
atrack$=add$(buttonzahl$,3)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
elseif getfocus(Button4%)
if equ(statusbutton%,0)
atrack$=4
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
if neq(statusbutton%,0)
atrack$=add$(buttonzahl$,4)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
elseif getfocus(Button5%)
if equ(statusbutton%,0)
atrack$=5
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
if neq(statusbutton%,0)
atrack$=add$(buttonzahl$,5)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
elseif getfocus(Button6%)
if equ(statusbutton%,0)
atrack$=6
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
If neq(statusbutton%,0)
atrack$=add$(buttonzahl$,6)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
elseif getfocus(Button7%)
if equ(statusbutton%,0)
atrack$=7
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
if neq(statusbutton%,0)
atrack$=add$(buttonzahl$,7)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
@mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
elseif getfocus(Button8%)
if equ(statusbutton%,0)
atrack$=8
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
if neq(statusbutton%,0)
atrack$=add$(buttonzahl$,8)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
elseif getfocus(Button9%)
if equ(statusbutton%,0)
atrack$=9
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
if neq(statusbutton%,0)
atrack$=add$(buttonzahl$,9)
ifnot gt$(atrack$,@mcisend$(status cd number of tracks))
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
statusbutton%=0
endif
elseif getfocus(Button10%)
If neq(statusbutton%,0)
statusbutton%=0
atrack$=add$(buttonzahl$,0)
@mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
elseif getfocus(Button11%)
statusbutton%=1
buttonzahl$=1
elseif getfocus(Button12%)
statusbutton%=1
buttonzahl$=2
elseif getfocus(Buttonplay%)
if equ(statuspause%,0)
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
if equ(statuspause%,1)
mcisend$(play cd)
addstring play cd
case statusmciwindow%: @AddString(dlistb%,play cd)
statuspause%=0
settext buttonplay%,Play
endif
elseif getfocus(ButtonStop%)
@mcisend$(stop cd)
addstring stop cd
case statusmciwindow%: @AddString(dlistb%,stop cd)
statuspause%=0
elseif getfocus(ButtonPause%)
@mcisend$(pause cd)
addstring pause cd
case statusmciwindow%: @AddString(dlistb%,pause cd)
statuspause%=1
settext buttonplay%,weiter
elseif getfocus(bback%)
if neq$(atrack$,1)
if statusmodus%
zufall
mcisend$(add$(play cd from ,zzahl$))
addstring add$(play cd from ,zzahl$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,zzahl$))
elseif equ(statusmodus%,0)
atrack%=atrack$
sub atrack%,1
atrack$=atrack%
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
endif
elseif getfocus(bvor%)
if neq$(atrack$,@mcisend$(status cd number of tracks))
if statusmodus%
zufall
mcisend$(add$(play cd from ,zzahl$))
addstring add$(play cd from ,zzahl$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,zzahl$))
elseif equ(statusmodus%,0)
atrack%=atrack$
inc atrack%
atrack$=atrack%
mcisend$(add$(play cd from ,atrack$))
addstring add$(play cd from ,atrack$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,atrack$))
endif
endif
elseif getfocus(bmodus%)
if equ(statusmodus%,0)
settext bmodus%,Zufall
statusmodus%=1
elseif equ(statusmodus%,1)
settext bmodus%,Normal
statusmodus%=0
endif
endif
if mouse(40,135-70,165)
case equ(%mousekey,1): winexec(add$($winpath,\sndvol32.exe),1)
elseif equ(getcheck(cbox%),0)
if statuston%
mcisend$(set cd audio all on)
addstring set cd audio all on
statuston%=0
case statusmciwindow%: @AddString(dlistb%,set cd audio all on)
endif
elseif getcheck(cbox%)
ifnot statuston%
mcisend$(set cd audio all off)
addstring set cd audio all off
statuston%=1
case statusmciwindow%: @AddString(dlistb%,set cd audio all off)
endif
endif
If Equ(%message,$201)
UseCursor 5
Sendmessage(%hwnd,$0112,$0F012,0)
UseCursor 0
ReleaseCapture()
endif
if getfocus(bsvor%)
mcisend$(add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(add(val(mid$(mcisend$(status cd position),7,2)),10)))))
addstring add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(add(val(mid$(mcisend$(status cd position),7,2)),10))))
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(add(val(mid$(mcisend$(status cd position),7,2)),10)))))
elseif getfocus(bsback%)
if lt$(mid$(mcisend$(status cd position),7,2),09)
mcisend$(add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(sub(val(mid$(mcisend$(status cd position),7,2)),val(mid$(mcisend$(status cd position),7,2)))))))
addstring add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(sub(val(mid$(mcisend$(status cd position),7,2)),val(mid$(mcisend$(status cd position),7,2))))))
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(sub(val(mid$(mcisend$(status cd position),7,2)),val(mid$(mcisend$(status cd position),7,2)))))))
else
mcisend$(add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(sub(val(mid$(mcisend$(status cd position),7,2)),10)))))
addstring add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(sub(val(mid$(mcisend$(status cd position),7,2)),10))))
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,add$(mid$(mcisend$(status cd position),1,6),str$(sub(val(mid$(mcisend$(status cd position),7,2)),10)))))
endif
elseif getfocus(bcddoor%)
if equ$(mcisend$(status cd mode),open)
mcisend$(set cd door closed)
addstring set cd door closed
case statusmciwindow%: @AddString(dlistb%,set cd door closed)
elseif equ$(mcisend$(status cd mode),stopped)
mcisend$(set cd door open)
addstring set cd door open
case statusmciwindow%: @AddString(dlistb%,set cd door open)
elseif equ$(mcisend$(status cd mode),playing)
mcisend$(stop cd)
addstring stop cd
case statusmciwindow%: @AddString(dlistb%,stop cd)
mcisend$(set cd door open)
addstring set cd door open
case statusmciwindow%: @AddString(dlistb%,set cd door open)
endif
endif
If Equ(%message,$201)
UseCursor 5
Sendmessage(%hwnd,$0112,$0F012,0)
UseCursor 0
ReleaseCapture()
endif
case equ(27,%scankey): ende
if equ(statusmciwindow%,1)
if getfocus(dbutton%)
mcisend$(gettext$(dedit%))
addstring gettext$(dedit%)
addstring(dlistb%,gettext$(dedit%))
if neq$(mcisend$(gettext$(dedit%)),)
addstring(dlistb%,mcisend$(gettext$(dedit%)))
addstring mcisend$(gettext$(dedit%))
endif
endif
endif
ifnot or(getfocus(dlistb%),or(getfocus(dedit%),getfocus(dialog%)))
ifnot getfocus(dbutton%)
setfocus(%hwnd)
elseif getfocus(dbutton%)
setfocus(dlistb%)
endif
endif
if %wmtimer
settext edit1%,mcisend$(status cd current track)
settext edit2%,mcisend$(status cd number of tracks)
settext edit3%,mid$(mcisend$(status cd position),4,5)
settext edit4%,mcisend$(add$(STATUS CD LENGTH TRACK ,mcisend$(status cd current track)))
settext edit5%,mcisend$(status cd length)
settext edit6%,mcisend$(status cd mode)
endif
if equ$(mcisend$(status cd current track),mcisend$(status cd number of tracks))
enablewindow bvor%,0
elseif neq$(mcisend$(status cd current track),mcisend$(status cd number of tracks))
enablewindow bvor%,1
endif
if neq$(mcisend$(status cd current track),1)
enablewindow bback%,1
elseif gt$(@mcisend$(status cd number of tracks),1)
enablewindow bback%,0
endif
if statusmciwindow%
if neq(sub(getcount(dlistb%),1),getcursel(dlistb%))
sendmessage(dlistb%,$0186,sub(getcount(dlistb%),1),0)
endif
endif
if statusmodus%
if equ$(mid$(mcisend$(add$(status cd length track ,mcisend$(status cd current track))),1,2),mid$(mcisend$(status cd position),4,2))
if equ$(mid$(mcisend$(add$(status cd length track ,mcisend$(status cd current track))),4,2),str$(add(val(mid$(mcisend$(status cd position),7,2)),2)))
zufall
mcisend$(add$(play cd from ,zzahl$))
addstring add$(play cd from ,zzahl$)
case statusmciwindow%: @AddString(dlistb%,add$(play cd from ,zzahl$))
endif
endif
endif
If Equ(%message,$201)
UseCursor 5
Sendmessage(%hwnd,$0112,$0F012,0)
UseCursor 0
ReleaseCapture(an>
endif
wend
killtimer
mcisend$(stop cd)
mcisend$(close cd)
end