DECLARE FUNCTION mciExecute LIB "WINMM.DLL" ALIAS "mciExecute" _
(StrCommand AS STRING) AS INTEGER
DECLARE FUNCTION mciSendString LIB "WINMM.DLL" ALIAS "mciSendStringA" _
(StrCommand AS STRING, ReturnString AS STRING, _
ReturnLength AS LONG, hwndCallBack AS LONG) AS INTEGER
DIM MusicFile AS STRING
MusicFile = "c:\windows\media\passport.mid"
IF mciExecute("Open "+MusicFile) THEN
CLS
mciSendString("Play "+MusicFile,"",0,0)
PRINT "Playing "+Musicfile
PRINT "Press 'P' to pause, 'R' to resume playing, ESC to quit"
DO
DO
A$ = UCASE$(INKEY$)
LOOP UNTIL LEN(A$)
IF A$ = "P" THEN
mciSendString("Pause "+Musicfile,"",0,0)
ELSEIF A$ = "R" THEN
mciSendString("Play "+Musicfile,"",0,0)
END IF
LOOP UNTIL A$=CHR$(27)
END IF
mciExecute("Close "+MusicFile)
|