OPTIONS "C_CALL LABELCHECK WINFUNC NOSOURCE"
DO
RXFUNCADD('rexxgui')
FUNCDEF("mciSendString", "32u, str, void, 32u, void", "winmm")
FUNCDEF("mciGetInfo", "32u, str, str[260] stor, 32u, void", "winmm", "mciSendString")
FUNCDEF("mciGetErrorString", "32u, 32u, str[260] stor, 32u", "winmm")
CATCH FAILURE
CONDITION("M")
RETURN
END
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
play = 0
err = mcisendstring('open cdaudio alias cd', 0, 0, 0)
IF err \= 0 THEN DO
mcierr:
mcigeterrorstring(err, buf, 260)
guisay(buf)
RETURN
END
err = mcigetinfo("status cd number of tracks wait", buf, 260, 0)
IF err \= 0 THEN DO
mcierr2:
mcisendstring("close cd wait", 0, 0, 0)
SIGNAL mcierr
END
guiaddctltext("NumOfTrks", buf)
err = mcisendstring("set cd time format tmsf", 0, 0, 0)
IF err \= 0 THEN SIGNAL mcierr2
mcisendstring("close cd wait", 0, 0, 0)
again:
DO FOREVER
guigetmsg()
CATCH SYNTAX
CONDITION('M')
SIGNAL again
CATCH HALT
FINALLY
IF play \== 0 THEN DO
mcisendstring("stop cd wait", 0, 0, 0)
mcisendstring("close cd wait", 0, 0, 0)
END
guidestroywindow()
END
RETURN
wm_click_playbutton:
IF play == 0 THEN DO
err = mcisendstring('open cdaudio alias cd', 0, 0, 0)
IF err \= 0 THEN DO
mcigeterrorstring(err, buf, 260)
guisay(buf)
END
ELSE DO
err = mcisendstring("play cd from 1 to 2 notify", 0, 0, guiwindow)
IF err \= 0 THEN DO
mcigeterrorstring(err, buf, 260)
guisay(buf)
END
ELSE DO
play = 1
guiaddctltext("PlayButton", "Stop")
END
END
END
ELSE DO
mcisendstring("stop cd wait", 0, 0, 0)
play = 0
mcisendstring("close cd wait", 0, 0, 0)
guiaddctltext("PlayButton", "Play")
END
RETURN
wm_extra:
SELECT ARG(3)
WHEN 953 THEN DO
mcisendstring("stop cd wait", 0, 0, 0)
play = 0
mcisendstring("close cd wait", 0, 0, 0)
guiaddctltext("PlayButton", "Play")
END
OTHERWISE
END
RETURN ""
|
|