Very well; what if the reference to the sound is needed elsewhere in the program? The answer might be to assign a system variable. But MCI, though not usually known for its elegance, provides a very clean way of dealing with media references: the alias.
An alias is in fact a lot like a system variable,except that it can be used in a callMCI() function anywhere in the application (evenINSTALL LOG
MOUSE
AUTOEXECB~K
CONFIG B~K
PMACLAN5
INSTALL TMP
CONFIG 1
AUTOEXEC1
CONFIG 2
AUTOEXEC2
AUTOEXEC3
PMACLAN VOL
CORELDRV
VR
WINWORD
Stage Page
Stage Page
-#, #?
,%H.%
where mm source max
open d:\mtb30\samples\asym01.avi alias mm style child parent
play mm
buttonClick
close mm
MCINotify
TO HANDLE buttonClick
d:\mtb30\samples\asym01.avi alias mm style child
" && sysClientHandle && "wait")
callMCI("where mm source
= " "
= ","
"dv" = ((
) + 1),((
) + 1)
("play mm",
B"b")
MCINotify
close mm")
isOpen
Natural Size
close mm wait
buttonClick
TO HANDLE buttonClick
callMCI("close mm wait")
Close All
-#, #?
,%H.%
where mm source max
open d:\mtb30\samples\asym01.avi alias mm style child parent
play mm
buttonClick
close mm
MCINotify
TO HANDLE buttonClick
d:\mtb30\samples\asym01.avi alias mm style child
" && sysClientHandle && "wait")
callMCI("where mm source
= " "
= ","
"dv" =
("play mm",
B"b")
MCINotify
close mm")
isOpen
Natural Size
TO HANDLE EnterPage
4LOGICAL scanning
4INT xs,ys
--use the
4property sysPageUnitsPerPixel
screen unit
pixel conversions. You
e also
Uvarious
--functions.
--Assign
_just
avoid having
so many
T(though
wastes a few bytes
memory
a little
xs =
ys =
--Initialize
" flag so that
= FALSE
--Play a clip
stage.
mmPlay
"stoats"
"scrl"
--Forward
message so higher levels receive
sysOpenMedia <> NULL
mmClose
4POINT location
= TRUE
= mousePosition
handler will
appropriate
--cursor
messages resume.
|ploc,isShift,isCtrl,isRight
bmpOffset
bmpSlop
bmpLoc
thout processing
hourglass
control key,
pressed:
o= 4)
a repeating
, so prevent flicker
--slowdown
Hsetting
only
needed. Use
four-pointed
o<> 7
It -
It -
--mmVisualSize
a built-
representing the
--"actual"
source image. The
Hgetting
value
could have been used instead.
--are assigned
It - 640) * xs
It - 480) * ys
= thePos("
) <= 0 \
) <= 0 \
) > -
) > -
>kScroll
--Update
bitmap:
newPos
--Clear
stores
let Windows take over
attend
other needs,
--clog
mmYield
--This
a custom
which uses imageCommand()
units.
passed
TO GET
g"status" \
&& mmDeviceAlias
&& "
wait")
It * xs
It * ys
. A "TO SET"
--would
visually more elegant
Hway
balancing the
--"TO GET"
, but a user
's made up
literals,
.. Don't forget
separate
a list
; "," (comma).
x1 = (
q)/xs
x2 = (
q)/ys
"," (
" && (
q)/xs \
& "," & (
q)/ys && "
--Restore
--isn't already
current
o<> 44
o= 44
Stage Page
stoats
Pusharound
Scroll
Page 5
clippingWindow
Pusharound
enterPage
Pusharound
leavePage
Pusharound
viewerFromPoint
buttonStillDown
TO HANDLE
4OBJECT clippingWindow
"Pusharound"
focusWindow =
--Closing a
will suspend execution
begin
f. Either test
-ness
temporarily
FALSE
4closing. This example uses a
isOpen
close
viewerFromPoint =
Stage Page
Press to Play
open c:\windows\chimes.wav alias sd wait
Playing
play sd wait
buttonClick
successful
close all
Press to Play
MCINotify
TO HANDLE buttonClick
= "Playing"
callMCI("
c:\windows\chimes.wav alias sd wait")
2play sd
zMCINotify s,c,d
s = "successful"
|close
= "Press
aying
.WAV File
<BookPath>
:HDMEDIAPATH
System
enterBook
TO HANDLE
Pusharound
Page "Stage Page"
Page id 0
warning
Page id 6
CAUTION: ALTERNATE VERSION
Pusharound Scroll
-#, #?
,%H.%
where mm source max
open d:\mtb30\samples\asym01.avi alias mm style child parent
play mm
buttonClick
close mm
MCINotify
TO HANDLE buttonClick
d:\mtb30\samples\asym01.avi alias mm style child
" && windowhandle
"dv" && "wait")
callMCI("where mm source
= " "
= ","
"dv" =
("play mm",
B"b")
MCINotify
close mm")
isOpen
close mm wait
buttonClick
TO HANDLE buttonClick
callMCI("close mm wait")
Close All
Play in Popup Viewer
speed
enterPage
-", #>
set mm speed
buttonClick
TO HANDLE buttonClick
ZINT x
x =
callMCI("
mm speed" & x)
<> "4000"
= "4000"
= "1000"
Speed 1000
close mm wait
buttonClick
TO HANDLE buttonClick
callMCI("close mm wait")
Close All
-#, #?
1, #?
speed
open d:\mtb30\samples\asym01.avi alias mm style child
where mm source max
parent
put mm window at 160 70 0 0
set mm speed
play mm
buttonClick
close mm
MCINotify
TO HANDLE buttonClick
d:\mtb30\samples\asym01.avi alias mm style child" \
" && windowhandle
&& "wait")
callMCI("where mm source
)160 70 0 0")
mm speed" && (
("play mm",
B"b")
MCINotify
close mm")
Press to play video in child window:
Toggle play speed between 1x (1000) and 4x (4000):
-", #>
set mm speed
buttonClick
enterPage
TO HANDLE buttonClick
ZINT x
x =
callMCI("
mm speed" & x)
<> "4000"
= "4000"
= "1000"
NOTIFYBEFORE
K= "1000"
TO HANDLE EnterPage
4LOGICAL scanning
4INT xs,ys
--use the
4property sysPageUnitsPerPixel
screen unit
pixel conversions. You
e also
Uvarious
--functions.
--Assign
_just
avoid having
so many
T(though
wastes a few bytes
memory
a little
xs =
ys =
--Initialize
" flag so that
= FALSE
--Play a clip
stage.
"scrl"
= "0,0"
mmPlay
3"stoats"
--Forward
message so higher levels receive
sysOpenMedia <> NULL
mmClose
4POINT location
= TRUE
= mousePosition
handler will
appropriate
--cursor
messages resume.
|ploc,isShift,isCtrl,isRight
bmpOffset
bmpSlop
bmpLoc
thout processing
hourglass
control key,
pressed:
o= 4)
a repeating
, so prevent flicker
--slowdown
Hsetting
only
needed. Use
four-pointed
o<> 7
It -
It -
--mmVisualSize
a built-
representing the
--"actual"
source image. The
Hgetting
value
could have been used instead.
--are assigned
It - 640) * xs
It - 480) * ys
= thePos("
) <= 0 \
) <= 0 \
) > -
) > -
--Update
bitmap:
newPos
--Clear
stores
let Windows take over
attend
other needs,
--clog
mmYield
--This
a custom
which uses imageCommand()
units.
passed
TO GET
g"status" \
&& mmDeviceAlias
&& "
wait")
It * xs
It * ys
. A "TO SET"
--would
visually more elegant
Hway
balancing the
--"TO GET"
, but a user
's made up
literals,
.. Don't forget
separate
a list
; "," (comma).
" && (
q)/xs \
& "," & (
q)/ys && "
--Restore
--isn't already
current
o<> 44
o= 44
7 TO HANDLE EnterPage
4LOGICAL scanning
4INT xs,ys
SHOW VIEWER "WARNING"
--use the
4property sysPageUnitsPerPixel
screen unit
pixel conversions. You
~ also
Uvarious
--functions.
--Assign
_just
avoid having
so many
T(though
wastes a few bytes
memory
a little
xs =
ys =
--Initialize
" flag so that
= FALSE
--Play a clip
stage.
"scrl"
= "0,0"
mmPlay
2"stoats"
--Forward
message so higher levels receive
sysOpenMedia <> NULL
mmClose
IF ISOPEN OF
CLOSE
4POINT location
= TRUE
= mousePosition
handler will
appropriate
--cursor
messages resume.
|ploc,isShift,isCtrl,isRight
bmpOffset
bmpSlop
bmpLoc
thout processing
hourglass
control key,
pressed:
o= 4)
a repeating
, so prevent flicker
--slowdown
Hsetting
only
needed. Use
question mark
special
o<> 38
o= 38
It -
It -
--mmVisualSize
a built-
representing the
--"actual"
source image. The
Hgetting
value
could have been used instead.
--are assigned
It - 640) * xs
It - 480) * ys
= thePos("
) <= 0 \
) <= 0 \
) > -
) > -
--Update
bitmap:
newPos
--Clear
stores
let Windows take over
attend
other needs,
--clog
mmYield
TO GET
--Restore
--isn't already
current
o<> 44
o= 44
-#, #?
MoveWindow
+!MoveWindow
where mm source max
status mm window handle
play mm
alias mm style child parent
buttonClick
close mm
MCINotify
TO HANDLE buttonClick
ZWORD hWnd
"file"
" &&
&& "alias mm style child
" && sysClientHandle && "wait")
\ = callMCI("status mm
where mm source
linkDLL "USER"
INT MoveWindow(
)+1, (
)+1, 1)
("play mm",
MCINotify
close mm")
unlinkDLL "
Add 1 Pixel to Size
close mm wait
buttonClick
TO HANDLE buttonClick
callMCI("close mm wait")
Close All
-#, #?
MoveWindow
+!MoveWindow
where mm source max
status mm window handle
play mm
alias mm style child parent
buttonClick
close mm
MCINotify
TO HANDLE buttonClick
ZWORD hWnd
"file"
" &&
&& "alias mm style child
" && sysClientHandle && "wait")
\ = callMCI("status mm
where mm source
linkDLL "USER"
INT MoveWindow(
), 1)
("play mm",
MCINotify
close mm")
unlinkDLL "
Natural Size
-#, #?
MoveWindow
+!MoveWindow
where mm source max
status mm window handle
play mm
alias mm style child parent
buttonClick
close mm
MCINotify
TO HANDLE buttonClick
ZWORD hWnd
"file"
" &&
&& "alias mm style child
" && sysClientHandle && "wait")
\ = callMCI("status mm
where mm source
linkDLL "USER"
INT MoveWindow(
) - 3, (
) - 3, 1)
("play mm",
MCINotify
close mm")
unlinkDLL "
Subtract 1 Pixel from Size
d:\mtb40\samples\asym01.avi
File:
rce max
status mm window handle
open d:\mtb30\samples\asym01.avi alias mm style child parent