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.

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