Windows Media Player ActiveX Control Example
NOTE:
ActiveX Controls have been deprecated by Microsoft in the latest versions of the
Windows operating system in favor of the DotNet framework and its controls.
While MAXScript still supports ActiveX controls, these have to be installed and registered
on the system to be accessible to MAXScript.
As a replacement of ActiveX controls, MAXScript supports DotNet controls in 3ds Max 9 and higher.
The following example will not work unless the Windows Media Player ActiveX control
is registered on your system.
The following example creates a Windows Media Player in a rollout.
-
You can load an avi file by clicking the "Pick Avi" button and choosing an Avi file
from disk.
-
When the play button is hit the "on timer..." event is called. This synchronizes the
time slider with the active frame in the media player!
-
Click "Show properties" to get all the properties listed in the listbox.
-
You can get a property's value by selecting the property name from the listbox.
-
You can also set a property by picking a property from the listbox and entering the
new value in the text field below.
SAMPLE SCRIPT
|
rollout rActiveX "Windows Media Player in a Rollout"
(
local val
activeXControl ax "{05589FA1-C356-11CE-BF01-00AA0055595A}" height:200 width:300 align:#left
button btnPick "Pick Avi" pos:[320, 10]
button btnProps "Show Properties" pos:[320, 50]
listBox lbProps "Properties:" pos:[420, 10] width:170
editText etValue "Value:" pos:[385, 170] width:200
label lblStatus "" pos:[440, 190]
on btnPick pressed do
(
local f = getOpenFileName caption:"Pick Any Avi File" types:"*.avi"
if f != undefined then ax.FileName = f
)
on btnProps pressed do
(
showProperties ax
lbProps.items = getPropNames ax
)
on lbProps selected sel do
(
if lbProps.items.count > 0 then
(
try ( val = getProperty ax lbProps.items[sel] )
catch ( val == undefined )
etValue.text = val as string
)
)
on etValue entered text do
(
try( setProperty ax lbProps.selected (text as (classof val)) ) catch( etValue.text = "Set Failed")
)
on ax timer do
(
sliderTime = animationRange.start + (ax.CurrentPosition * (animationRange.end - animationRange.start))/(ax.selectionEnd - ax.selectionStart)
)
on ax PositionChange oldPos newPos do
(
format "[%, %]\n" oldPos newPos
)
)
nf = newRolloutFloater "Test ActiveX" 650 300
addRollout rActiveX nf
|