LIBRARY rexxgui
DO
FUNCDEF("MCIWndCreate", "void, void, void, 32u, str", "msvfw32")
FUNCDEF("SendMessage", "void, void, 32u, void, void", "user32")
FUNCDEF("mciGetErrorString", "32u, 32u, str[260] stor, 32u", "winmm")
FUNCDEF("DestroyWindow", "32u, void", "user32")
CATCH FAILURE
CONDITION("M")
RETURN
END
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
mcihandle = 0
again:
DO FOREVER
guigetmsg()
CATCH SYNTAX
CONDITION('M')
SIGNAL again
CATCH HALT
FINALLY
IF mcihandle \== 0 THEN DO
mciwndstop(mcihandle)
mciwndclose(mcihandle)
END
guidestroywindow()
END
RETURN
wm_click_playbutton:
IF mcihandle == 0 THEN DO
fn = ''
err = guifile('FN', 'EXISTING', 'Pick out an AVI file', 'Video files (*.avi) | *.avi | All files (*.*) | *.*')
IF err = '' THEN DO
mcihandle = mciwndcreate(, , 268435456 + 256 + 2 , fn)
IF mcihandle == 0 THEN guisay("Can't create MCI window!")
ELSE DO
mcisetowner(mcihandle, guiwindow)
err = mciwndplay(mcihandle)
IF err \== 0 THEN DO
mciwndclose(mcihandle)
mcihandle = 0
mcigeterrorstring(err, buf, 260)
guisay(buf)
END
ELSE DO
guiaddctltext("PlayButton", "Stop")
END
END
END
END
ELSE DO
mciwndstop(mcihandle)
mciwndclose(mcihandle)
mcihandle = 0
guiaddctltext("PlayButton", "Play")
END
RETURN
wm_extra:
SELECT ARG(3)
WHEN 1229 THEN DO
END
WHEN 1224 THEN DO
IF ARG(2) = '525' & mcihandle \== 0 THEN DO
mciwndclose(mcihandle)
mcihandle = 0
guiaddctltext("PlayButton", "Play")
END
END
OTHERWISE
END
RETURN ""
mciwndplay:
RETURN sendmessage(ARG(1), 2054 , 0, 0)
mciwndclose:
sendmessage(ARG(1), 2052 , 0, 0)
destroywindow(ARG(1))
RETURN 0
mciwndstop:
RETURN sendmessage(ARG(1), 2056 , 0, 0)
mcisetowner:
RETURN sendmessage(ARG(1), 1176 , ARG(2), 0) |